Jan 31, 2015

Lookup / Describe a Stored Procedure in SQL Server

I was working with a invisible database for which I had a JNDI connection to but not its credentials to get onto a SQL Server Management Studio IDE and look up the objects such as Tables and Stored procedures. So I end up working with a Stored Proc which slammed me repeatedly for several hours with a "Too many arguments" error, was trying to find out any possible ways to lookup the signature of the SP.

For SQL tables, we had queries like "DESC TABLE_NAME" to lookup the columns, and I wanted something similar to lookup the input/output definition of a stored procedure. So after going through the documentation of SQL server, I find this command that got me exactly what I need. sp_helptext is the built in function that helped me see the source code, and finally figure out how it works. This is the syntax.

sp_helptext @objname = N'dbo.spNameGoesHere'";

Ha! I would no longer worry when that DBA goes on vacationing!

No comments:

Post a Comment

You may also like these writeups

Related Posts with Thumbnails

Join our Gang