none
T-SQL Comments

    Question

  • Is there a way to comment t-sql without having to store the comments inside the stored procedure?  I'd like to document the code without having to necessarily alter the stored procedure.  I was thinking there might be an add-in or some other type of procedure to follow.
    Thursday, May 15, 2014 7:22 PM

Answers

  • When right clicking design on a table, the descriptions you type for column or a table inside SSMS, are stored in an extended property named "MS_Description". 

    Even if I don't see a field for description for stored procedure, I personally use the same extended property for this and any object I want to document.  This way you do not have to look for thousands of different properties depending on the object you document.

    If you are doing it through TSQL, look for the sp_addextendedproperty procedure.

    http://technet.microsoft.com/en-us/library/ms180047(v=sql.105).aspx

    Through interface, just go properties/extended properties.


    Thursday, May 15, 2014 7:52 PM

All replies

  • You can add extended properties which will explain the purpose of the SP. But it is not the same as comments inline of the code where they are the most helpful.

    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog


    My TechNet articles

    Thursday, May 15, 2014 7:29 PM
    Moderator
  • When right clicking design on a table, the descriptions you type for column or a table inside SSMS, are stored in an extended property named "MS_Description". 

    Even if I don't see a field for description for stored procedure, I personally use the same extended property for this and any object I want to document.  This way you do not have to look for thousands of different properties depending on the object you document.

    If you are doing it through TSQL, look for the sp_addextendedproperty procedure.

    http://technet.microsoft.com/en-us/library/ms180047(v=sql.105).aspx

    Through interface, just go properties/extended properties.


    Thursday, May 15, 2014 7:52 PM