Home » Blog Feed » All categories » Technology And Information Management » Basic SQL Server Object Naming Convention Guidance
Microsoft doesn’t provide macro guidance for naming conventions, however, sometimes, it is useful to have a place to start. Also, there are times when flexibility with naming conventions is necessary. So, here is a quick set of SQL Server naming conventions, which may be helpful if you find yourself working with a customer who doesn’t have an established set of naming convention standards and you need to assemble a set fast.
Basic SQL Server Object Naming Convention Guidance
Each project will have its own schema.
Schema represents the project
First letter of each word in table/Column starts with Uppercase.
Put Underscore(_) between words of table/Column name
No space between words in table/column name
Object Conventions
SQL Server objects
Subject
Prefix/Suffix
Naming convention
Example
Database db db<name> dbODS Job jb jb<Jobname> jbSSIS_RunLoadPackage Linked Server ls ls<linkedservername> lsServer01 Trigger(Delete) td td<name> tdAppointment Trigger(Insert) ti ti<name> tiCustomer Trigger(Update) tu tu<name> tuAppointment
SQL Server Database objects
Subject
Prefix/Suffix
Naming convention
Example
Aggregate function af af<Name> afTotalSales Assemblies as ass<Name> assDetermineIPs Attribuut – <name> PatientName Database data file(s) data# <database>_data# dbAdventureWorks_data1 Database log file log <database>_log dbAdventureWorks_log Default df df<name> dfDate Dimension Table _Dim <<Table Name>>_Dim Geography_Dim Fact Table _Fact <<TableName>>_Fact Accounts_Payable_Fact Filegroup fg fg<name> fgdbAdventureWorks_Index Filestream fs fs<name> fsInvoiceDoc Foreign key FKx_ FKx_<sourcetable>_<goaltable>_<fieldname(s)># Index (not unique, non clustered) IDX_ IDX_<name>_<column> Index (unique, non clustered) UDX_ UDX_<name>_<column> Index (not unique, clustered) CIX_ CIX_<name>_<column> Index (unique, clustered) CUX_ CUX_<name>_<column> Materialized View MV_ MV_<Table name> Primary key PK_ PK_<name> PK_KlantID Scalar valued function scf scf<name> scfDetermineNumberOfCustomers Schema sch sch<name> schOrders Stored procedure usp usp<projectname>_<name> uspArchive_DetermineNumberOfOrders Synonyms syn syn<name> Table tbl tbl<name> tblCustomers Table Valued function tvf tvf<name> tvfDeterminecustomers Temporary Table #tmp #tmp<name> #tmpPatient25Years Type udd udd<name> uddPostcode Type tp tp<name> tpPosInt View vw_ VW_<table name> vwGetOpenOrders
Transact SQL (T-SQL)
Subject
Prefix/Suffix
Naming convention
Example
Bigint inb inb<Variabelename> inbPatientId Binary bin bin<Variabelename> binMessage Bit bit bit<Variabelename> bitOK Char chr chr<Variabelename> chrPatientname Code (Field) _Code <Variabelename>_Code Program_Code Cursor cur cur<Variabelename> curField Date (Field) _Dt <Variabelename>_Dt Created_Dt Datetime dtm dtm<Variabelename> dtmInsertDate Description (Field) _Desc <Variabelename>_Desc Plan_Desc Float flt flt<Variabelename> fltXvalue Identity (Field) _ID <Variabelename>_ID Status_Rollup_ID Integer int int<Variabelename> intPatientID Money mny mny<Variabelename> mnyTotalAmount Nchar chrn chrn<Variabelename> chrnPatientname Ntext txtn txtn<Variabelename> txtMessage Numeric of decimal dec dec<Variabelename> decAmount Nvarchar chvn chvn<Variabelename> chvnPatientname Real rea rea<Variabelename> reaAmount Smalldatetime dts dts<Variabelename> dtsInsertDate Smallint ins ins<Variabelename> insSubcategorieID Smallmoney mns mns<Variabelename> mnsAmount Sql_variant var var<Variabelename> varFreevalue Surrogate key (Field) _ID <Variabelename>_ID Person_ID Table variable tav tav<name> tavCustomers Text txt txt<Variabelename> txtReport Timestamp tsp tsp<Variabelename> tspDeleteDate Tinyint iny iny<Variabelename> inyCategorieID Uniqueidentifier guid guid<Variabelename> guidKeu Varbinary biv biv<Variabelename> bivMessage Varchar chv chv<Variabelename> chvPatientname
Like this: Like Loading...
Related
Post navigation