Stored Procedure Defination from C#

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
 
H

Hans Kesting

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top