Casing
Prefix
Suffix
Alpha Numeric Characters
Notes
Tables
Pascal
x
Use singular form: Eg User, not Users
Linking Tables
Link
Formed from the Tables they are linking, eg: A Table joining User and Group would be UserGroupLink
Table Columns
Primary Key
PK_
Clustered Index
IXC_
Unique Clustered Index
IXCU_
Unique Index
IXU_
Index
IX_
XML Index
XML_IX_
XML Columns
Use .net Pascal casing, no underscores
Constraints
CK_
Default Value
DF_
Foreign Keys
FK_
Views
VW_
Functions
FN_
Stored Procedures
none
Triggers (after)
TRGA_
Triggers (instead)
TRGI_
use the following components in the order below;
Classifier
Description
Suggested SQL Data Type
Address
Street or mailing address data
nvarchar
Age
Chronological age in years
int
Average
Average; consider a computed column
numeric
Amount
Currency amount
money
Code
Non Database Identifier
Count
Data
A field containing extensible data
xml
Date
Calendar date
smalldatetime
Datetime
Date including time
datetime
Day
Day of month (1 - 31)
tinyint
Brief narrative description
nvarchar(MAX)
Duration
Length of time, eg minutes
ID
Unique identifier for something
Image
A graphic image, such as a bitmap
varbinary(MAX)
Flag
Not Required: Flag indicates a boolean indicator, where the Qualifier verb does not make it clear it is a verb. Examples of a Qualifier are: Is, Has, Uses. Eg IsEnabled
bit
Month
Month of year
Name
Formal name
Number
Percent
Number expressed as a percent
Quantity
A number of things
any numerical
Rate
Number expressed as a rate
Ratio
A proportion, or expression of relationship in quantity, size, amount, etc. between two things
Sequence
A numeric order field
Text
Freeform textual information
Time
Time of day
Title
Formal name of something
Version
Timestamp
timestamp
Weight
Weight measurement
XML
A field containing xml data
Year
Calendar year or julian year number
· Use PascalCase
· Use PascalCase, except for prefix
For Views which are updatable, act as if they are a table.
This holds true for Updatable Partitioned Views.
For Views which provide a view on the data which makes them read only.
· Example Trigger Names:
o TRGA_CustomerInsUpdDe
o TRGA_ProductDel
o TRGI_AuthorUpd
Index names are unique within a table so it isn’t necessary to include the tablename in the index. When looking at execution plans it is helpful to have a hint about the columns being indexed
· Example Index Names:
o IXCU_AuthorID (clustered unique)
o IXU_AuthorID (unique)
o IX_AuthorID_AuthorName (composite index)
o IXC_AuthorID (clustered not unique)
o PK_Customer
Avoid abbreviations, unless absolutely necessary, due to length restrictions