• Christian Buettner-167247 (12/1/2010)


    Nils Gustav Stråbø (12/1/2010)


    Both the definition and the comments can be retrieved from sys.syscomments view

    Are you sure about that? I can't see any comments in that view.

    Comments are part of a procedure's definition, so if you retrieve the definiton, you retrieve the comments as well.

    CREATE PROCEDURE QOTD_Test

    AS

    PRINT 'This is a test'; -- this is a comment

    GO

    SELECT "text" FROM sys.syscomments WHERE id = OBJECT_ID('QOTD_Test');

    The result of the SELECT statement contains the "this is a comment" comment 🙂