Include Comments ABOVE the ALTER PROC statement
mcaldwell@isidc.com
Posts: 3 Bronze 2
I like to put my header comment block ABOVE the ALTER PROCEDURE or CREATE PROCEDURE statement (similar to what you would see in C# code above a method definition). As long as it is within the same batch (between the GOs) this works fine and it is stored as part of the definition in SQL Server. If I right-click on a procedure in Object Explorer and choose Modify, SQL Server opens a window with the comment included.
But if I use SQL PROMPT snippet AP<tab> pick-the-name<tab> it only displays what came after the original ALTER PROCEDURE statement. And if I go ahead and execute that, then my comment is eliminated.
I have refreshed the cache before testing this, so it is not a problem of being out-of-date, just apparently not being there at all. It would be great if this would retrieve the full definition including my preceding comment.
But if I use SQL PROMPT snippet AP<tab> pick-the-name<tab> it only displays what came after the original ALTER PROCEDURE statement. And if I go ahead and execute that, then my comment is eliminated.
I have refreshed the cache before testing this, so it is not a problem of being out-of-date, just apparently not being there at all. It would be great if this would retrieve the full definition including my preceding comment.
Comments
If you have any further suggestions/problems then please do not hesitate to let us know.