Retrieving schema for a stored procedure.

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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.
 
Back
Top