Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

Statement for returning stored procedure params
Hi all,

I'd like to put together a SQL statement that will take the name of a
stored procedure as a param, and return that SP's parameters.

I'm writing a test application, and I'd like to wrte a generator to
save myself some time, but I can't seem to figure out how to get the
params from a SP.  Any help would be appreciated.

Thanks in advance,

Craig


Report this thread to moderator Post Follow-up to this message
Old Post
Capsule
10-27-05 10:28 PM


Re: Statement for returning stored procedure params
Capsule (Capsulec@hotmail.com)  writes:
> I'd like to put together a SQL statement that will take the name of a
> stored procedure as a param, and return that SP's parameters.
>
> I'm writing a test application, and I'd like to wrte a generator to
> save myself some time, but I can't seem to figure out how to get the
> params from a SP.  Any help would be appreciated.

I happened to have this one canned:

SELECT name = CASE colid WHEN 0 THEN NULL ELSE name END,
paramno = colid, type = type_name(xtype),
max_length = length, "precision" = coalesce(prec, 0),
scale = coalesce(scale, 0),
is_input  = CASE colid WHEN 0 THEN 0 ELSE 1 END,
is_output = CASE colid WHEN 0 THEN 1 ELSE isoutparam END,
is_retstatus = 0
FROM   dbo.syscolumns
WHERE  id = @objid
UNION
SELECT NULL, 0, 'int', 4, 0, 0, 0, 1, 1
WHERE  NOT EXISTS (SELECT *
FROM   dbo.syscolumns
WHERE  id = @objid
AND  colid = 0)
ORDER   BY paramno



--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp


Report this thread to moderator Post Follow-up to this message
Old Post
Erland Sommarskog
10-27-05 10:28 PM


Re: Statement for returning stored procedure params
Thank you so much for your time, Erland!   That was just what I was
looking for.

Craig


Report this thread to moderator Post Follow-up to this message
Old Post
Capsule
10-28-05 01:23 AM


Sponsored Links





Last Thread Next Thread
Post New Thread

Microsoft SQL Server forum archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 03:08 PM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006