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
This is only a preview. Your comment has not yet been posted.
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.
Posted by: |