Today, I received a task to alter a number of stored procedures and create its “alter” script. So if you need to alter the script, you need to either right click on database>> stored procedure and filter the stored procedure and then create its alter script or add sp_helptext before any stored procedure to get its script. I normally prefer to go with the second option.
However, if you need to get the script of stored procedure, you need to write “sp_helptext” as many times as you need the script of stored procedure. Here is the solution.
You simply need to add a shortcut in SQL Server and have fun.
But the question is how to do it?
Lets proceed step by step.
Step 1 :
Go to Tools >> Options >> and in the Options you need to go to Environment >> Keyboard
and set “Sp_helptext” in front of “Ctrl+F1”. Meaning, whenever you press “Ctrl+F1” it will work like “Sp_helptext”
Step 2 :
Now, write any stored procedure and press “Ctrl+F1”. Ooops….. It’s not working.
So, it will not work in the already opened window. Open a new window, then connect the SSMS again and try to use it. This time it will work.
For example : Write any stored procedure and press “Ctrl+F1”. It will give you its script.
Now, my purpose is resolved but I was thinking that whenever I need to browse a table I need to write “Select * from” + TableName.
So why not we add this one also in the shortcut.
Lets do it and review the impact.
Now add “Select * from” in front of “Ctrl+3”
Now, open a new window again and type any table name and press “Ctrl+3”
Now you can browse any table without writing “Select * from”
I was trying to do the same. But my direction was incorrect. Thanks for sharing it. A very useful post.
thank u very much…. It’s going to help me a lot..
i tried with this but still it is not reflecting, i even reconnected the sql server , any idea
ohh i checked it and it is working for procedures (like sp_help) but not working for procs which are under a schema, any help
In this case you need to specify the complete name with the schema.Given below is the sample.
http://wp.me/a1Wgn3-2eM