Tuesday, December 23, 2003

Easiest way to add comments to your SQL 2k code ...

If you are using SQL Server (2K) Query Analyzer to create your Stored procedure / Function / View / Trigger etc., then probably the below tip (!!!) might be of use to you. This would be particularly useful to maintain uniformity in commenting the code when more than one developer is working on a project.

Step 1: Create a comment template something like the one I have shown below:

Name             : Name of the SP/Function/View/etc., comes here
Parameters    : Details about the parameters should come here.

Description     : Give a detailed description about the procedure here

Developer      : M. Vadivel (Put your name here :) )
Created Date : Date on which the procedure is created comes here

Change History:-

Modified By:     Modified Date:

Test Script  : Sample execution script would come here. For example, Execute GetDataFromEmployee '10'

Step 2: Save it as a file with an extension .tql @ ....\Microsoft sql server\80\tools\templates\SQL Query Analyzer

Step 3: So from now on you just need to press "CTRL" + "SHIFT" + "INSERT" and select the .tql file which you have created.

Easy isn't it?

No comments: