Sql-server – How to Determine the input and output values of stored procedures

parametersql-server-2008-r2stored-procedures

I have hundreds of SPs and I would like to find out:

  • input parameters with type
  • output fields with type (not output parameters)

Of course I could manually go through each one and write it down but where is the fun in that…No, literally where IS the fun in that 🙂

Can this be done or does Sql Management Studio 2008 R2 have this capability already?

I do not even know where to start so any answer is acceptable.

Edit for enhancment of question:
If we look at it as 2 different tasks, could we accomplish this easier. Even using reflection on the client side. (A quick and dirty console app would suffice.)

Best Answer

You should be able to do that using the system view INFORMATION_SCHEMA.PARAMETERS. You'll have there what you need.

It "returns one row for each parameter of a user-defined function or stored procedure that can be accessed by the current user in the current database. For functions, this view also returns one row with return value information."

PS: if the answer to Martin's question is "columns in the result set", then ignore my answer, it is only for the parameters of the procedures, not for any result.