Getting the Proc Code–#SQLNewBlogger

Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers.

I saw a question recently about getting the code in a stored procedure. I’ve become dependent on SQL Prompt, which gives me a nice preview of code when I see a proc:

2020-06-30 16_42_34-ObjectDefinitionBox

The main way I’ve gotten code is right clicking a proc in Object Explorer and clicking Modify. That opens up an ALTER statement for the proc.

2020-06-30 16_42_44-

However, there’s one more way to do this: sp_helptext.

2020-06-30 17_26_18-SQLQuery2.sql - ARISTOTLE_SQL2017.Sandbox (ARISTOTLE_Steve (82))_ - Microsoft SQ

Not the best solution, but it gives me a quick look from SQL without futzing through a big list in the OE.


This is a quick example of some knowledge that I can use in my regular work. When someone asked the question, I knew the code for procs was stored somewhere, but I wasn’t sure what the proc to get this was. I tried sp_help, but that wasn’t right, so I had to go look up sp_helptext.

This took about ten minutes to write.

About way0utwest

Editor, SQLServerCentral
This entry was posted in Blog and tagged , , . Bookmark the permalink.

1 Response to Getting the Proc Code–#SQLNewBlogger

  1. This is a bit of high-level learning for me who is still starting in the beginner’s level. But, worth keeping this as a good resource.


Comments are closed.