views:

359

answers:

3

I heard that there is a keyboard short cut to bring up the code of a SQL Server 2005 (Management Studio) stored procedure. This key combination would do the same function as sp_helptext.

This may only be an Urban Legend.

Thanks

+2  A: 

The first thing I do after installing management studio on a new machine is to set sp_helptext to be CTL+F1 in management studio.

Tools / Options / Environment / Keyboard / Ctrl-F1 == sp_helptext

Then, i can highlight any view, stored proc, function, whatever - and press CTL-F1 and get the text of the object in my results window. Not sure if this is exactly what you're looking for, but it definitely helps me to be more productive in the query windows.

Scott Ivey
Scott - You're the man. Thanks for the help.
codingguy3000
Note that in order for this to work, you have to be in the relevant database. So to avoid "surprises", if proc_a exists in DB_A, make sure you do a USE DB_A. Because if proc_a also happens to be in DB_B, you might be surprised.
Liao
Aside from this specific example, I've had numerous cases where QA folks run SQL's on the wrong database, thats so frustrating.
Liao
+1  A: 

Just using the Ctrl + F1 for the first time it works well & displays the SP in the results grid.

Shortcut hotkey combination to view the code of an SP can also be done by the following:

  1. F8 - Open Object Explorer

  2. Arrow keys down to SP

3 Right Click (usually located between right windows key & right ctrl key)

4 Y - press Y which will select Modify

5 New Query Window opens with alter SP code

Hope this helps

Catto