Home All Groups Group Topic Archive Search About

Get a list of available stored procedures

Author
28 Nov 2007 1:11 PM
roundcrisis
Hi there:

I would like to retrive a collection with the avvaialbe stored
procedures, if there are any,
I m using an ODBC connection,
How can this be achieved?
I know u can do a select of one of the system tables with a sql
server, but what happens if i dont have a sql server?
Cheers

Author
28 Nov 2007 3:40 PM
Ignacio Machin ( .NET/ C# MVP )
Hi,

What DB r u using?

In SQL server it's kept in a system table (sysobjects IIRC).

Why are u using a ODBC connection though?

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
Show quote
"roundcrisis" <roundcri***@gmail.com> wrote in message
news:e00dca7c-57c9-4e3d-9fe9-8dc01e5ca061@d4g2000prg.googlegroups.com...
> Hi there:
>
> I would like to retrive a collection with the avvaialbe stored
> procedures, if there are any,
> I m using an ODBC connection,
> How can this be achieved?
> I know u can do a select of one of the system tables with a sql
> server, but what happens if i dont have a sql server?
> Cheers
Author
28 Nov 2007 3:41 PM
zacks
On Nov 28, 8:11 am, roundcrisis <roundcri***@gmail.com> wrote:
> Hi there:
>
> I would like to retrive a collection with the avvaialbe stored
> procedures, if there are any,
> I m using an ODBC connection,
> How can this be achieved?
> I know u can do a select of one of the system tables with a sql
> server, but what happens if i dont have a sql server?
> Cheers

As far as I am aware, there is no standard ODBC method of obtaining a
list of stored procedures on the server you are connected to. Some SQL
providers do not even support stored procedures, from what I
understand. So it depends on the actual provider itself on how to
obtain the list of SPs. For MS SQL Server it is:

select * from information_schema.routines
Author
28 Nov 2007 3:42 PM
Nicholas Paldino [.NET/C# MVP]
Well, if you don't have a SQL Server, then you will have to use whatever
DB-specific method will give you a list of the stored procedures (there is
not one standardized way of getting stored procedures across all data
sources).

    Also, the provider really doesn't matter in this case (ODBC is a
provider that can connect to many data sources, as is OLEDB) unless it is
for one product and one product only (SQL Server, for example) and even
then, it might not give you the information you want.

    For SQL Server, you can simply run the sp_stored_procedures stored
procedure and it will return a list of stored procedures to you:

http://msdn2.microsoft.com/en-us/library/ms190504.aspx


--
          - Nicholas Paldino [.NET/C# MVP]
          - mvp@spam.guard.caspershouse.com

Show quote
"roundcrisis" <roundcri***@gmail.com> wrote in message
news:e00dca7c-57c9-4e3d-9fe9-8dc01e5ca061@d4g2000prg.googlegroups.com...
> Hi there:
>
> I would like to retrive a collection with the avvaialbe stored
> procedures, if there are any,
> I m using an ODBC connection,
> How can this be achieved?
> I know u can do a select of one of the system tables with a sql
> server, but what happens if i dont have a sql server?
> Cheers
Author
28 Nov 2007 4:28 PM
Ben Voigt [C++ MVP]
Show quote
"Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard.caspershouse.com> wrote in
message news:OXFziSdMIHA.3400@TK2MSFTNGP03.phx.gbl...
>    Well, if you don't have a SQL Server, then you will have to use
> whatever DB-specific method will give you a list of the stored procedures
> (there is not one standardized way of getting stored procedures across all
> data sources).
>
>    Also, the provider really doesn't matter in this case (ODBC is a
> provider that can connect to many data sources, as is OLEDB) unless it is
> for one product and one product only (SQL Server, for example) and even
> then, it might not give you the information you want.
>
>    For SQL Server, you can simply run the sp_stored_procedures stored
> procedure and it will return a list of stored procedures to you:
>
> http://msdn2.microsoft.com/en-us/library/ms190504.aspx

Just require users with other DB engines to write sp_stored_procedures in
their database -- it's like implementing a common interface.

Then be prepared for sp_stored_procedures to show up in the list on some
databases, and filter it out before showing the user...

AddThis Social Bookmark Button