Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determine Input params at runtime

Status
Not open for further replies.

JSpicolli

Programmer
Apr 2, 2004
208
0
0
US
is there a way to get the names of a proc's params?

 
Do you mean something like:

exec sp_help myproc
 
no.

I mean like being able to iterate thru a collection of input params and get specific param properties such as name and value.

Sorry, I am not usually a SQL developer, so forgive me if my questions are off the wall.

if I can't iterate the params, is there a way to use Case on an insert???

Something like

Code:
[COLOR=green]
 /*
   @sOption1 and @sOption2 are input params
 */
[/color]

While @iterator <= @iParamCount
BEGIN
CASE 
 WHEN @iterator = 1 AND Len(@sOption1) > 0 THEN
   INSERT INTO myTable (col1, col2) VALES ('v1', @sOption1)
   WHEN @iterator = 2 AND Len(@sOption2) > 0 THEN
   INSERT INTO myTable (col1, col2) VALES ('v1', @sOption2)
 END
 SET @iterator = (@iterator + 1)
END
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top