Retrieving schema for a stored procedure.

G

Guest

I am able to retrieve the schema for a set of stored procedures by running
each of the stored procedures and then calling GetSchemaTable but I don't
want to run the stored procedure if it is going to modify the database. How
can I get the output schema for a stored procedure either without having to
execute the stored procedure or changing each stored procedure so that the
INSERT, UPDATE, DELETE, etc. doesn't happen (but the schema is still
returned).

Thank you for your suggestions.

Kevin
 
W

W.G. Ryan eMVP

Kevin, if I understand you correctly, you can call the sp_helptext stored
procedure passing in the name of the proc. Using an ExecuteReader...
while(reader.Read()){

}
construct, you can loop through the text and create a string containing the
text in the proc. This will let you examine it and decide what action to
take.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top