STandards for SQL Server implementation

  • Does anybody know or have a nice document about standards in SQL server.

    I mean the prefixes for the names on the table, how do yoy declare the variables,

    prefixes for stored procedures,etc.....

    Is it better to have prefixes per functional area or prefixes per object type.

    msp_YYYYYYYY for Storedproc xxxxx

    tbl_XXXXXXXX for tables

    Does anybody have these guidelines ready and is willing to shere them ?

  • Hi, see the article: -

    http://www.sqlservercentral.com/columnists/sjones/codingstandardspart1.asp

    Regards,

    Andy Jones

    .

  • I Like it !!!!

  • The method of obj_Name is an off shoot of Hungarian notation commonly used in other programming languages. As I program in C++, VB, etc I prefer this naming convention.

    First the Steve Jones article presents a nice reasoning and suggestions for standards. But with SQL (as with other languages) what you choose to use is up to you. Just be carefull of thing like don't use SP or XP for Procedure names and don't name a database sys... as these have draw backs to the compiler or will casue confusion later. But all in all you need to set down and decide what you standard will be, document it, determine how to enforce it and enforce it. It should be logical and make quick sense to th next person who comes along.

  • I liked andy's article but there is nothing about stored procedures.....

    I know now how to write a query and how to format it but what aboud declaring variables etc....

    ( really like the part about the column list an copying it to the order by..... that I didn't thought of that myself.......... )

  • Stored Procedures are presented in a straight forward manner (as far as I think of it, but I do have advantage of several years) in SQL Books Online. I suggest lookup CREATE PROCEDURE and start there. Then if you have specific questions post to the site.

  • One other thing that I found useful is to add a header to stored procedures...

    /******************************************

    ** Procedure: {Proc_Name}

    **

    ** Notes: {describe the use of the procedure}

    **

    ** Author: {AKA: Who to talk to for changes}

    **

    ** Date: {When was it created}

    **

    ** In Params: {List params/what is expected}

    **

    ** Return Value: {Recordset, Outparam, XML}

    **

    ** History: {Date, Initials, Reason changed}

    ********************************************/

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply