Blog Post

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.

Original post (opens in new tab)
View comments in original post (opens in new tab)