Sqlserver-dba.com

Subscribe

Subscribe to RSS feed  Follow @jackvamvas - Twitter

Enjoy this post? Enter your email address for updates on new posts:

Delivered by FeedBurner

Email +Jack Vamvas at jack@sqlserver-dba.com

SQLServer-DBA.com Links

Subscribe to newsletter

Dba_db2_button

Powered by TypePad
SQL Stored Procedure Commenting

19 June,2012 by Jack Vamvas

Question : Do you have a template for commenting in a  SQL Stored Procedure?

Answer: If you maintain a  source control system  ,  you probably maintain detailed comments,  and version history.

I work with a  DBA  who argues , comments in source control systems are sufficient. I disagree.  Maintaining comments on code deployed has many benefits. Such as :

 a)       Troubleshooting b) documentation .

There are some other  useful techniques available to for commenting  on database objects

SQL Server has a feature called Extended Properties  which supports adding meta data information to objects .

I distribute this example to developers. Maintaining comments with code is part of the Production approval process - and part of my Stored Procedure Checklist

----------------------------------------------------------------------------------------------
-- OBJECT NAME         : MyStoredProcedure
-- INPUTS    : @myParam1 NVARCHAR(128),@myParam2 INT
-- OUTPUTS    : @myOutParam1 NVARCHAR(128)
-- DEPENDENCIES         : None
-- AUTHOR    :     Jack Vamvas
-- DESCRIPTION         : This stored procedure accepts 2 parameters 
--
-- EXAMPLES (optional)  : EXEC MyStoredProcedure ‘sqlserver’, 2
--
-- Version HISTORY : version|Author|Date| Comment
---1.0      JV 7\10\2011 Initial Version
--1.2       JV 11\10\2011  added CONVERT

Author: Jack Vamvas (http://www.sqlserver-dba.com)

Enjoy this post? Enter your email address for updates on new posts:

Delivered by FeedBurner

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer