SQL SERVER Database Coding Standards and Guidelines Complete List Download

SQL Server Interview Questions and Answers
Print Book Available (207 Pages) | Sample Chapters

Download SQL SERVER Database Coding Standards and Guidelines Complete List

Just like my previous series of SQL Server Interview Questions and Answers Complete List Download, I have received many comments and emails regarding this series. Once I go through all the emails and comments, I will make summary of them and integrate them with my series. I have also received emails asking me to create PDF for download. I have created that as well. Please feel free to download it and use it.

Please ask me any questions you might have. Contact me if you are interested in writing mini series with me.

Download SQL SERVER Database Coding Standards and Guidelines Complete List

Complete Series of Database Coding Standards and Guidelines
SQL SERVER Database Coding Standards and Guidelines – Introduction
SQL SERVER – Database Coding Standards and Guidelines – Part 1
SQL SERVER – Database Coding Standards and Guidelines – Part 2
SQL SERVER Database Coding Standards and Guidelines Complete List Download


Other popular Series

SQL Server Interview Questions and Answers Complete List Download
SQL SERVER – Data Warehousing Interview Questions and Answers Complete List Download

Reference : Pinal Dave (http://blog.SQLAuthority.com)

About these ads

84 thoughts on “SQL SERVER Database Coding Standards and Guidelines Complete List Download

  1. Hi Pinal,

    That is a Very Very Good Compiled Document. Appreciate it

    However, just one things i noticed. Please correct me if i am wrong.

    Stored Procedure Naming Convention
    – Is it feasible to start the User Created Stored procedure Name with “sp” ,since SQL Server looks for the Stored Procedure in the Master Database and assumes it to be as a System defined Stored Procedure?

    I know you have mentioned not to start with “sp_”, but just a thought.

    Thanks
    Deepan S.

  2. Thanks Deepan,

    As far as I know ‘SPName’ is no problem but ‘sp_’. When I reviewed this document and that particular issue with other SQL Expert, we all agreed that it is fine.

    If anybody has other opinion or documentation. I am willing to adopt, but at this moment I think ‘spNAME’ (no underscore) is fine.

    Regards,
    Pinal Dave (SQLAuthority.com)

    • Hi Pinal Dave,
      i wanted to know is there any software exist which checks for database standards for a given stored procedure. please let me know this thanks and
      Regards
      Santosh Kakani

  3. Hello Mr. Dave,

    Your articles are amazing and really very useful. I am a beginner in SQL BI and looking for resources, interview questions. It would be a great help if you can point me to those resources.

    Thanks

  4. Hi. Nice articles but I am interested in why you would want to prefix all stored procedures with ‘sp’. In the case of stored procedures I understand there is no impact but it seems superfluous and makes the natural reading of code less easy.

    It reminds me somewhat of the polish notation used by many VB programmers that in the end leads to problems. Luckily ones that don’t currently afflict SQL.

  5. Hello Mr. Dave,

    Your articles are amazing and really very useful. This should
    be done by each professional to encourage the begginners.
    your work is really appreciable.

    Go ahead

    Thanks
    sachin

  6. Hi,
    I think you should add the (NOLOCK) attribute as well.

    eg:

    SELECT UserID FROM [User] (NOLOCK)
    or
    SELECT u.UserID,s.SessionID FROM [User] u (NOLOCK) INNER JOIN [Session] s (NOLOCK) ON u.UserID=s.UserID

    Jaysam

  7. Pingback: SQL SERVER - Pre-Code Review Tips - Tips For Enforcing Coding Standards Journey to SQL Authority with Pinal Dave

  8. hi Pinal Dave, I just graduated with a degree in network communication and management i would like to know of any more info to help me learn the sql server to further my carrer. i am studying now for my ccna and want all the expeirence i can get to futher myself if u can help i would greatly appreciate the info to learn maybe some books you could recommend. i am egar to learn from someone who has such a vast knowledge of this field

    thanks R.Haynes

  9. Good Pinal Dave,
    Keep updating the things……….
    I want to send some new concept of performance tunning and new way of using sql server 2005 coding stratergy. I will appreciate you if you can provide me your mail ID so that i can send you the document which i Collect from my learnings………

    Thanks & Regards
    Shashi Kant Chauhan

  10. how can i count number of column in a row with same data?
    i have a table with column empid,month, day1, day2 ………….day31 i want to count number of ‘p’ and ‘a’ of that employee id?

  11. i am not written this for u .because i really dont no which word i say to u. no word is expressed to u.U R a very tallented person ,u have a great capabilities to done all u r effort.u also done a work that needed all jobseekers like me.
    i just searches SQL related questions with ansers ,and i get this wonderful and easy solution from u.

    thanks ,may have 2 requst u plz contact with me.

    best of luck u r next …………………………………………………………………..
    till end

  12. Pingback: SQL SERVER - Add Column With Default Column Constraint to Table Journey to SQL Authority with Pinal Dave

  13. Pingback: SQL SERVER - Popular Articles of SQLAuthority Blog Journey to SQL Authority with Pinal Dave

  14. Pingback: SQL SERVER - How to Rename Database Objects to Comply With Naming Conventions Journey to SQL Authority with Pinal Dave

  15. Hi,

    It is a very very good article. I never think these kind of questions. Thanks a lot for doing research on it and all the best for further research.

    Regards
    Sajitha

  16. Hello,

    Great document!

    I noticed you recommend having your table names be ‘plural’. It seems there are those who are passionate about making them singular. I was wondering what your reasoning is for doing it your way.

    Thanks
    Frank

  17. Hi Pinal,

    Really appreciate the work you have done.

    Have a question for you in regards to SQL Server Database Coding Standards and Guidelines

    Other than keeping within ANSI92 or being Oracle compatible why do you say “Do not use the identitycol or rowguidcol”?

    Thanks keep up the good work!!

    Zach

  18. Hi Pinal

    Really nice compilation. I am greately benifitted.

    I was going thru your article on Coding Standards. You have mentioned

    “Use BEGIN..END blocks only when multiple statements are present within a conditional code
    segment.”

    I think we should always use BEGIN…END blocks. Anyone else maintaining a code that I have written may put another line and lured by the indent think that he has put the statement inside the block. Later this may be a nightmare for the third person to debug.

  19. HI

    I am preparing for interviews.
    If you can send me latest interview questions on SQL and PL?SQL that would be great.

    Site is very useful

  20. Pingback: SQL SERVER - 2008 - Introduction to Policy Management - Enforcing Rules on SQL Server Journey to SQL Authority with Pinal Dave

  21. Hi,

    Great document!

    I noticed you recommend having table names as ‘plural’ but table is an entity and i think an entity should always be in ‘singular’. Correct me if i am wrong

    Thanks
    Ashok

  22. I agree with most of your guidelines. One that I don’t agree with, is using varchar instead of TEXT. TEXT results in a 16-byte only fixed column, while a varchar(max) could result in 8KB being accessed by the HDD and sent to the resultset. It just serves better to have a huge amount of data off-table and only accessed when needed. Even if a SELECT list is provided, excluding the varchar, the hard drive still has to read all of it into the page before producing the selective list, which is a waste.
    Ordinarily, I try to assess the maxlength of a varchar and its usability, and if it’s going to be used infrequently and could be very large, it goes into a TEXT column.

    One guideline I use that you didn’t mention, is to have keys at the front of the table, followed by fixed-length columns and variable length columns at the end of the table. Your assessment that varchars are faster to process than chars is only valid when the column length is large. Varchars require the application of a base address with an off-set to reach them. If one places fixed-length columns behind varchars, they, too, will be subject to an off-set. Setting relationships against columns behind varchars places a huge overhead burden on the server.

    Just some thoughts.

    • Did you notice this point from BOL about TEXT datatype?

      This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Use varchar(max), nvarchar(max) and varbinary(max) data types instead. For more information, see Using Large-Value Data Types.

  23. Hi Pinal,

    Impressive stuff!

    I am currently looking for a tool which verifies whether SQL standards are met in the in the SQL script. For example if a input a stored procedure script then i would like see a report on what all predefined coding standards not met in the stored procedure.

    Do you know any tools available like that or let me know pointers to build that kind of a tool.

  24. HI

    I am preparing for interviews.
    If you can send me latest interview questions on SQL and PL?SQL that would be great.

    Site is very useful

  25. Pingback: SQLAuthority News - Best Downloads on SQLAuthority.com Journey to SQL Authority with Pinal Dave

  26. Pingback: SQLAuthority News - Best Articles on SQLAuthority.com Journey to SQL Authority with Pinal Dave

  27. Pingback: SQL SERVER - Database Interview Questions and Answers Complete List Journey to SQL Authority with Pinal Dave

  28. thanks for such a nice supportive platform to enhance the skill and share their views for other awareness.

    Really, Pinalkumar Dave u are providing a helpline to the SQL professionals.

    Ajay Sinha

  29. hi Mr. Dave,

    Your articles are amazing and really very useful. I am a in SQL DBA looking for resources, interview questions. It would be a great help if you can point me to those resources.

  30. I found your article very usefull and with many good advices.

    I just noticed in the first advice in page 6, when you share how we can handle apostrophe withing a string, that you named the variable as @sExample, where I belive the “s” after “@” is part of your sintaxis for naming your variables depending of the data type.

    That is a another good think to do, but you did not go in further details about that.

    I would like to know what are your advices for variabe naming.

  31. nic e job,
    you have done..
    i never seen this type of this type of user frendly knowledge shearing blog.
    i impressed..
    many time when i get problem or in trouble it helped me..

  32. Pingback: SQL SERVER – Weekly Series – Memory Lane – #032 | Journey to SQL Authority with Pinal Dave

  33. Hi Pinal,

    This is related to the guideline “Do not store binary or image files inside database.”

    As per the research paper published in April 2006 – “Objects smaller than 256K are best stored in a database while objects larger than 1M are best stored in the filesystem. Between 256K and 1M, the read:write ratio and rate of object overwrite or replacement are important factors.”
    Link – http://research.microsoft.com/apps/pubs/default.aspx?id=64525

    Thanks,
    Anoo S Pillai

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s