SQL SERVER – Query Analyzer Short Cut to display the text of Stored Procedure

This is quick but interesting trick to display the text of Stored Procedure in the result window. Open SQL Query Analyzer >> Tools >> Customize >> Custom Tab
type sp_helptext against Ctrl+3 (or shortcut key of your choice)

Press CTRL + T to enable the text view in result window.
Type any Stored Procedure name in your database, select the SP name and type Ctrl+4.

You will see the Stored Procedure text in the Result Window.

Reference: Pinal Dave (http://www.SQLAuthority.com)

34 thoughts on “SQL SERVER – Query Analyzer Short Cut to display the text of Stored Procedure

  1. Is there any trick to do this in SQl Server Management Studio ??

    There’s something to define shortcuts but it doesn’t work !!

    I think we have to add something to indicate the selected text is the parameter of sp_helptext… but don’t know what !!



  2. In answer to Hollywood, the shortcuts thing (Tools | Options | Environment | Keyboard) does work, you just have to restart Management Studio before it recognizes the shortcut. It then takes the selected text as the parameter automatically


  3. This is useful, but it’s something I am aware of. Call me lazy, but what I am looking for is a way to output the text (code) of a stored procedure in Text mode (results to text) in the Management Studio of SQL Server 2005. I can currently do this by a combination of Ctrl+T and Ctrl+F1 (which I’ve assigned to sp_helptext). Is there any way to achieve both actions using a single keyboard shortcut?


  4. Hi
    This is prabu really am enjoying your reply its simply good and i have a issue

    This is am trying to use query shortcut i assigned the query for the short cut actually what i did is

    1. Option -> Enviroinment -> Keyoard and then i set

    ctrl +3 =Select * from
    2.Then i come back to query window and selected a table and then i hit ctrl +3 but it dosen’t show anything if you help me for this its really usefull for me

    thanks in advance


  5. Hi,
    I’m using sql 2008. ctrl+ F is not working.
    even selecting find option from the edit menu is not working.
    if i select the ctrl+tab it shows the active window for find option , but selecting it doesnt show the find window.


  6. I’m using QA2000 and I set the procedure sp_helptext on Ctrl+3 shortcut, for example, and on editor pane I selected (highlighted) a procedure name (salesbycategory on Northwind database) and pushed Ctrl+3, but I got the following error:

    Server: Msg 201, Level 16, State 3, Procedure sp_helptext, Line 0
    Procedure ‘sp_helptext’ expects parameter ‘@objname’, which was not supplied.

    How can I use a shortcut (sp_helptext) and set an argument (salesbycategory) for it?



  7. keyboards>> ctrl+3 = sp_helptext

    If you need to see the procedure means just give the procedurename



    select above procedure and press ctrl+3 it will work perfect…


  8. Hi

    I need to set Select * from to ctrl+3

    I have select the tablename by using ctrl+3

    it shows

    Incorrect syntax near ‘From’. this issue…

    Help me…



  9. Hi, I have the same problem with management studio 2005. I have ctrl+3 shortcut assigned to “SELECT * FROM “. I open new query window run shortcut and I get the message Incorrect syntax near ‘FROM’.

    It looks like the shortcut doesn’t pass the selected value.

    Someone, Please help!!!


  10. Windows 7 with keyboard short cut for SQL server 2005 It does not work any reference for that

    Thank You
    Kirti Darji


  11. Pingback: SQL SERVER – Weekly Series – Memory Lane – #014 « SQL Server Journey with SQL Authority

      • yes this can be a case but I want to create shortcut for a procedure which takes more than one parameter. suppose I have a procedure which returns records based on two filter conditions and user has to pass that two values.

        exec myProc @parm1=value1, @parm2=value2

        One more thing how to create shortcut for followinw query
        select top 10 * from where RowStatus=1

        where RowStatus is


  12. Hi, i tried with the shortcut and i worked bu on problem – it is working for procedures (like sp_help) but not working for procs which are under a schema, any help


  13. Tools >>Options>> Environment>>KeyBoard
    set the specific key to shortcut then easy to get the data or insert or update with out writing all the syantax

    Thanks a lot


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s