PC Review


Reply
Thread Tools Rate Thread

How do I get the schema of a stored procedure

 
 
David Thielen
Guest
Posts: n/a
 
      25th Jun 2009
Hi;

I am using the following to get all stored procedures in a Sql Server
database:

cmd.CommandText = "SELECT
o.name FROM dbo.sysobjects o where (OBJECTPROPERTY(o.id,
N'IsProcedure') = 1 " +
"or
OBJECTPROPERTY(o.id, N'IsExtendedProc') = 1 or OBJECTPROPERTY(o.id,
N'IsReplProc') = 1) and " +
"o.name not like
N'#%%' and OBJECTPROPERTY(o.id, N'IsMSShipped') = 0 order by o.name";

How can I get the schema for each stored procedure?

thanks - dave

david@at-at-(E-Mail Removed)
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com

Cubicle Wars - http://www.windwardreports.com/film.htm
 
Reply With Quote
 
 
 
 
Colbert Zhou [MSFT]
Guest
Posts: n/a
 
      26th Jun 2009
Hello Dave,

Why not use the connection.GetSchema function to retrieve the procedure and
its schema information. Mark gives a sample codes in his blog,
http://blogs.msdn.com/mab/archive/20...schema-definit
ions-of-stored-procedures-in-net.aspx

By the way, what kind of schema you are expecting? Do you mean you also
need to get the desired parameters information for each stored procedure?
If that is the case, we need to use the SqlCommandBuilder's
DeriveParameters property to retrieve that.
http://msdn.microsoft.com/en-us/libr...sqlcommandbuil
der.deriveparameters.aspx

Hope this helps! Have a nice weekend!


Best regards,
Colbert Zhou
Microsoft Newsgroup Support Team

 
Reply With Quote
 
David Thielen
Guest
Posts: n/a
 
      26th Jun 2009
Hi;

GetSchema("procedures") gives the schema, but not the description or
if it's a system or user proc. Schema is more important but is there
any way to get both?

For GetSchema("ProcedureParameters") it does not return if the
parameter has a default value or what that default value is. It also
does not return the description. Is there a way to get those
(especially the default)?

thanks - dave


On Fri, 26 Jun 2009 08:09:16 GMT, (E-Mail Removed)
(Colbert Zhou [MSFT]) wrote:

>Hello Dave,
>
>Why not use the connection.GetSchema function to retrieve the procedure and
>its schema information. Mark gives a sample codes in his blog,
>http://blogs.msdn.com/mab/archive/20...schema-definit
>ions-of-stored-procedures-in-net.aspx
>
>By the way, what kind of schema you are expecting? Do you mean you also
>need to get the desired parameters information for each stored procedure?
>If that is the case, we need to use the SqlCommandBuilder's
>DeriveParameters property to retrieve that.
>http://msdn.microsoft.com/en-us/libr...sqlcommandbuil
>der.deriveparameters.aspx
>
>Hope this helps! Have a nice weekend!
>
>
>Best regards,
>Colbert Zhou
>Microsoft Newsgroup Support Team



david@at-at-(E-Mail Removed)
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com

Cubicle Wars - http://www.windwardreports.com/film.htm
 
Reply With Quote
 
David Thielen
Guest
Posts: n/a
 
      5th Jul 2009
On Fri, 26 Jun 2009 16:19:49 -0600, David Thielen
<(E-Mail Removed)> wrote:

>Hi;
>
>GetSchema("procedures") gives the schema, but not the description or
>if it's a system or user proc. Schema is more important but is there
>any way to get both?
>
>For GetSchema("ProcedureParameters") it does not return if the
>parameter has a default value or what that default value is. It also
>does not return the description. Is there a way to get those
>(especially the default)?


Hi;

Any luck finding a solution for this? This is merely a "nice to have"
so if it's a lot of work - please do not work on this.

thanks - dave

david@at-at-(E-Mail Removed)
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com

Cubicle Wars - http://www.windwardreports.com/film.htm
 
Reply With Quote
 
David Thielen
Guest
Posts: n/a
 
      5th Jul 2009
On Sun, 05 Jul 2009 13:28:17 -0600, David Thielen
<(E-Mail Removed)> wrote:

>On Fri, 26 Jun 2009 16:19:49 -0600, David Thielen
><(E-Mail Removed)> wrote:
>
>>Hi;
>>
>>GetSchema("procedures") gives the schema, but not the description or
>>if it's a system or user proc. Schema is more important but is there
>>any way to get both?
>>....


Got an answer for is a schema a user or system schema part of the
question below.

thanks - dave

david@at-at-(E-Mail Removed)
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com

Cubicle Wars - http://www.windwardreports.com/film.htm
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Retrieving schema for a stored procedure. =?Utf-8?B?S2V2aW4gQnVydG9u?= Microsoft ADO .NET 2 20th Aug 2006 08:49 PM
Failed to get schema for this stored procedure DC Gringo Microsoft ASP .NET 1 8th Sep 2004 03:54 PM
Generating xml schema for a stored procedure Noor Microsoft VB .NET 1 2nd Feb 2004 08:25 PM
Generating xml schema for a stored procedure Noor Microsoft Dot NET 0 27th Jan 2004 07:59 AM
Generating xml schema for a stored procedure Noor Microsoft ADO .NET 0 27th Jan 2004 07:59 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:22 AM.