Determining parameters of a stored procedure

  • Thread starter Thread starter uiranejeb
  • Start date Start date
U

uiranejeb

How can I determine the parameters of a SQL Server stored procedure based
only the name of stored procedure.
Ideally it will be to obtain a collection of SqlParameters.

Thanks!
 
thsis query will return the info

select
'Parameter_name' = name,
'Type' = type_name(xusertype),
'Length' = length,
'Prec' = case
when type_name(xtype) = 'uniqueidentifier' then xprec
else OdbcPrec(xtype, length, xprec)
end,
'Scale' = OdbcScale(xtype,xscale),
'Param_order' = colid,
'Collation' = collation
from syscolumns where id = object_id('dbo.myproc')
order by colid


-- bruce (sqlwork.com)
 
Have a look at Microsofts Data Access Application Block. It contains a
SQL Helper class that is doing exactly what you need. It retrievs the
Parameters of a stored Procedure and caches them. Additionally
SQLHelper class provides methods to ease the execution of stored
procedures, so that you don't even have to care about the
specification of SQLParameters.

Data Access Application Block
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/daab-rm.asp

Hope this helps
Peter Gossmann
MCP for ASP.NET
 
Back
Top