代码的魅力

BI, .NET

导航

Database Coding Standard and Guideline

Posted on 2009-04-20 11:14  moge  阅读(152)  评论(0编辑  收藏  举报

Object type

Prefix

Example

Primary key Clustered

pkc_

pkc_MY_TABLE__Column

Primary key Nonclustered

pkn_

pkn_TB_TABLE__Column_List

Index Clustered

ixc_

ixc_TS2_TABLE__Column

Index Nonclustered

ixn_

ixn_TB_TABLE__Column_List

Foreign key

fk_

fk_THIS_TABLE__ColumnB__to__TB_PKEY_TABLE__ColumnA

Unique Constraint

unq_

unq_TB_TABLE__Column_List

Check Constraint

chk_

chk_TB_TABLE__Column

Column Default

dft_

dft_TB_TABLE_Column_List

Passed Parameter

@p

@pPassedVariableName

Local Variable

@

@VariableName

Table

TB_, *_

TB_TABLE_NAME (see detail below)

View

VW_

VW_NET_ACTIVE_UNITS

User Defined Scalar Function

ufs_

ufs_return_value_name

User Defined Table Function

uft_

uft_TB_TABLE_NAME

Stored Procedure

*

Eds_Def (see detail below)

    • Use the following standard prefixes for scripts:

Script type

Prefix

Example

Stored procedure script

proc_

proc_Calendar.sql

Schema script

def_

def_Calender.sql

Conversion script

conv_

conv_Schedule.sql

Rollback script

rbk_

rbk_Schedule.sql

    • Save all scripts using the .sql extension
    • Use the following standard column and variable suffix abbreviations:

Object Type

Suffix

Example

Account

_Acct

Process_Corp_Acct

Address

_Addr

Contact_Addr

Amount

_Amt

Total_Credit_Amt

Balance

_Bal

Available_Bal

Date or Datetime

_Dt

Active_Dt, @Archive_Dt

Description

_Desc

Product_Desc

Date of Birth

_DOB

Alternate_DOB

Indicator

_Ind

Net_Gross_Ind

Line(n)

_Ln(n)

Address_Ln2, @pOrderLn

Number

_Nbr

Bank_Nbr

Record identifier/identity

_Id

Entity_Id, @pEntityId

Tax Id Number

_TIN

Merchant_TIN

Card Transactions

_Trans

Daily_Nbr_Trans

Zip Code

_Zip

Recipient_Zip