Is there a recommended (official or not) style from Microsoft regarding naming and casing in T-SQL?

If there isn't one from Microsoft then is there one with broad acceptance?

  • Can you be more specific? Are you referring to object names, database names, user names, column names?
    – JNK
    Oct 17, 2012 at 12:53
  • 4
    Joe Celko wrote a whole book entitled "SQL Programming Style". It covers the subject in depth.
    – A-K
    Oct 17, 2012 at 13:11
  • Pretty much everything. There's one convention for C# for instance, then there must be one for T-SQL.
    – gsb
    Oct 17, 2012 at 13:11

2 Answers 2


There's no broad standard that I've seen used or heard widely recommended. Some recommend prefixing tables with tbl but some are very against that. Some, like myself, prefer to name the ID column simply so you always know what the ID column of any table will be called ID while others, like my coworker, prefer to put the tablename (ie - serverid) so what it's called in another table matches the column name in the parent table.

The most important thing is that the scheme you use remains consistent, especially within the same database. Most DBAs can pick up on the naming format as long as it doesn't change within an environment.


> If there isn't one from Microsoft then is there one with broad acceptance?

There is no accepted coding standard for T-SQL. However, I've always found that the code authored by Itzik Ben-Gan in his books is a really good example of how naming, capitalisation, spacing, and layout can make T-SQL appear more readable and understandable (and even elegant).

If you want to follow any 'standard' I'd suggest looking here first.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.