Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-09-11 : 14:07:01
|
Venkatesh Shanmuganathan writes "I'm looking at a way to collect the parameter list for a Stored Procedure into a single object and retrive them like argv[1], arv[2] inside the SP. We have that facility in Javascript, C, Java and was looking @ one in SPAny help / direction is appreciated" |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-09-11 : 14:25:06
|
You can get this from the following query:SELECT C.name, C.colid FROM syscolumns CINNER JOIN sysobjects O ON C.id=O.idWHERE O.name='myProcedure'That will list all of the parameters (if any) for the "myProcedure" procedure (change the name to match the one you want) along with their ordinal position (colid). There are additional columns that specify datatype, you'd have to add additional joins to systypes to get the type names.Realize that this WON'T allow you to address the actual values passed into the stored procedure, nor will you be able to dynamically address the parameters or their values; you will only get the names and data types that the procedure accepts. T-SQL is very, very different from other languages such as Java/JavaScript and C/C++, and doesn't support the same kind of techniques.If you need to address multiple values, consider passing them as comma-separated values and parsing them, using the techniques available in these articles:http://www.sqlteam.com/SearchResults.asp?SearchTerms=csv |
|
|
|
|
|