Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Stored Procedure Standards

Author  Topic 

ashearer
Starting Member

2 Posts

Posted - 2005-04-07 : 19:27:29
hi, this is my first post on sqlteam.com, so forgive me if this topic has been covered before.

I am wondering if anyone knows of Microsoft standards/guidelines for the layout and formatting of stored procedures??

Btw- does SQL Yukon, and the integration into the development IDE provide automatic SQL formatting, like is does with VB.net??

Thanks
Andrew


simondeutsch
Aged Yak Warrior

547 Posts

Posted - 2005-04-07 : 21:10:33
I don't know if these are Microsoft standards, but common is to

1. Comment liberally using /**/ and --, if anyone, or even you, ever has to look at your code. And code that may seem perfectly simple and sensible today will be incomprehensible tomorrow without comments. Famous last words: "What the hell does this line do?"

2. Indent every block equally.
3. I like to put all my DECLAREs together at the top.
4. Use SET NOCOUNT ON/OFF at the beginning and end of every proc to avoid skewered results by data providers.



Sarah Berger MCSD
Go to Top of Page

ashearer
Starting Member

2 Posts

Posted - 2005-04-07 : 22:22:02
quote:
Originally posted by simondeutsch


2. Indent every block equally.



this can be interpreted in so many ways….
i.e.

Select
Column 1
Column 2
From
Table
Where
Condition


Or


Select Column 1
Column 2
From Table
Where Condition



sorry, the plaintext formatting doesn't work, but you can imagine the indentation above
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-04-07 : 23:42:47
quote:
Originally posted by ashearer

hi, this is my first post on sqlteam.com, so forgive me if this topic has been covered before.

I am wondering if anyone knows of Microsoft standards/guidelines for the layout and formatting of stored procedures??

Btw- does SQL Yukon, and the integration into the development IDE provide automatic SQL formatting, like is does with VB.net??

Thanks
Andrew






none that i know of, formats are developed as per DBA or Developer's experience and these formats should be consistent and agreed by the team and should be understood by the team who will read/modify it

--------------------
keeping it simple...
Go to Top of Page
   

- Advertisement -