Stored Procedure Defination from C#

  • Thread starter Thread starter DIA
  • Start date Start date
D

DIA

Can we find the defination of a SQL stored procedure
using c#?

1. Using SQL-DMO in c# I was able to locate a SQL server
in the network.
2. Hit the target database in the selected server.
3. Get object of SQLDMO._StoredProcedure class point to
the stored procedures which i need to refer.

I am stuck at findding the parameters and their for the
particular stored procedure.

Can come body help me on this?

regards
 
DIA said:
Can we find the defination of a SQL stored procedure
using c#?

1. Using SQL-DMO in c# I was able to locate a SQL server
in the network.
2. Hit the target database in the selected server.
3. Get object of SQLDMO._StoredProcedure class point to
the stored procedures which i need to refer.

I am stuck at findding the parameters and their for the
particular stored procedure.

Can come body help me on this?

regards

Specifically for SQLServer:
you can use the "sysobjects", "syscolumns" and "systypes" tables to get
procedure and parameter information:

select o.name as procname, c.name as paramname, t.name as typename,
c.xtype, c.type, c.usertype, c.length,
c.prec, c.xscale, c.scale, c.colid, c.colorder,
c.isoutparam, c.isnullable, o.crdate
from sysobjects o
left outer join syscolumns c on o.id = c.id
left outer join systypes t on t.xtype = c.xtype
where o.xtype = 'P'
and o.name not like 'dt%'
order by procname, c.colorder


Hans Kesting
 
Back
Top