0

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?

1 Answer 1

2

Please try this:

select
PARAMETER_NAME,
DATA_TYPE,
CHARACTER_MAXIMUM_LENGTH,
PARAMETER_MODE,
NUMERIC_PRECISION,
NUMERIC_SCALE
from INFORMATION_SCHEMA.PARAMETERS
where specific_name = @chvProcName
order by ordinal_position

look for PARAMETER_MODE it will have a value of OUT

Got this info from here

HTH

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, this is definitely helpful; if I don't see any responses specific to the DeriveParameters method in .NET, I'll award you the answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.