Retrieve input and output parameters for SQL stored procs and functions?

Posted by Darth Continent on Stack Overflow See other posts from Stack Overflow or by Darth Continent
Published on 2010-04-22T21:18:32Z Indexed on 2010/04/22 21:23 UTC
Read the original article Hit count: 394

For a given SQL stored proc or function, I'm trying to obtain its input and output parameters, where applicable, in a Winforms app I'm creating to browse objects and display their parameters and other attributes.

So far I've discovered the SQL system function object_definition, which takes a given sysobjects.id and returns the text of that object; also discovered via search this post which describes extracting the parameters in the context of a app using the ADO.NET method DeriveParameters in conjunction with some caching for better performance; and for good measure found some helpful system stored procs from this earlier post on Hidden Features of SQL Server.

I'm leaning towards implementing the DeriveParameters method in my C# app, since parsing the output of object_definition seems messy, and I haven't found a hidden feature in that post so far that would do the trick.

Is DeriveParameters applicable to both functions and stored procs for purposes of retreiving their parameters, and if so, could someone please provide an example?

© Stack Overflow or respective owner

Related posts about sql-server-2005

Related posts about c#