Search code examples
sql-server-2008autocompletessmsredgate

Red Gate SQL Prompt - auto complete alter statements lose comments


Using SQL Prompt 4 (I'm aware there's an upgrade but I'm not responsible for that kind of thing..)

I like the ease of being able to write alter proc __ and have SQL Prompt fill the rest of the statement, bringing up the required procedue/view/whatever.

Unfortunately, any comments in the procedure that would appear if I'd have browsed through the object explorer of management studio and selected 'modify' (or script as..) disappear.

Is there a way of ensuring the comments are included? they also appear in the output of the proc sp_helptext.. these comments are above the initial 'alter proc' statement.

Cheers :)


Solution

  • You're right that comments before the ALTER PROC keywords are not inserted by SQL Prompt when it automatically fills in the stored procedure body after typing ALTER PROC manually or using the ap snippet. We are aware of this limitation.

    If you are able to use SQL Prompt 5 one day, there is an alternative in that version that can be used as a workaround. If you press F12 on a stored procedure name in a query (e.g. EXEC myproc), then a new query window is opened with the stored procedure scripted as ALTER -- this method does keep the initial comments, and isn't too many more keystrokes.

    Paul Stephenson
    SQL Prompt Project Manager
    Red Gate Software