tags:

views:

1159

answers:

8

Would just like too see what peoples Stored Procedure/Function etc comment headers look like (so post your examples)...I've only really seen what the SQL Server Management Studio creates but am interested in what other peoples look like...the formatting, characters used, procedure information/details etc I guess are what really makes them different...

sorry if this question doesn't make sense...thanks heaps!

SQL Server Management Studio (version 9) stored procedure comment header default:

-- =============================================
-- Author:   Name
-- Create date: 
-- Description: 
-- =============================================
+1  A: 

we use somthing like this and very use ful for me

/*
Description:
Author:
Create Date: Param:
Return:
Modified Date:
Modification:
*/

KuldipMCA
+1  A: 
-- [why did we write this?]
-- [auto-generated change control info]
Jeffrey Kemp
+4  A: 
/******************************
** File:    
** Name:
** Desc:
** Auth:
** Date:
**************************
** Change History
**************************
** PR   Date     Author  Description 
** --   --------   -------   ------------------------------------
** 1    01/10/2008      Dan      added  inner join
*******************************/
Hagai
when we add a new code to the stored procedure we add at the end of it a reference to the top. for example :select * from Boxes inner join Colors on Boxes.colorID=Colors.ID --PR#1
Hagai
That reminds me of the time we made the collective decision to remove all comments like "--PR#1" at the end of lines wherever we came across them. They never served any purpose. Forensic analysis of a change, in the rare instances when needed, was much easier using the change control software.
Jeffrey Kemp
A: 
--
-- STORED PROCEDURE
--     Name of stored procedure.
--
-- DESCRIPTION
--     Business description of the stored procedure's functionality.
--
-- PARAMETERS
--     @InputParameter1
--         * Description of @InputParameter1 and how it is used.
--
-- RETURN VALUE
--         0 - No Error.
--     -1000 - Description of cause of non-zero return value.
--
-- PROGRAMMING NOTES
--     Gotchas and other notes for your fellow programmer.
--
-- CHANGE HISTORY
--     05 May 2009 - Who
--        * More comprehensive description of the change than that included with the
--          source code commit message.
--
Convict
A: 

-- Author:

-- Original creation date:

-- Description:

Calmar
+2  A: 

Can I point out that all these "change history" and "modified date" fields can and should be obtained from your version control software, rather than being embedded in the code by the programmer. This is a lessson that C (for example) programmers learned long ago.

anon
A: 
Atul
A: 

The header that we currently use looks like this:

---------------------------------------------------
-- Produced By   : Our company  
-- URL       : www.company.com  
-- Author        : me 
-- Date      : yesterday  
-- Purpose       : to do something 
-- Called by     : some other process   
-- Modifications : some other guy - today - to fix my bug   
------------------------------------------------------------

On a side note, any comments that I place within the SQL i always use the format:

/* Comment */

As in the past I had problems where scripting (by SQL Server) does funny things wrapping lines round and comments starting -- have commented out required SQL.... but that might just be me.

Iain Hoult