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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Referring to Parameter/Variable names in stored proc

Status
Not open for further replies.

philmck

Programmer
Feb 19, 2004
8
GB
I want to loop through a small piece of code for each parameter @p1 to @pn passed into my stored procedure. Is there a way I refer to the parameters indirectly? e.g. in a local variable which will change on each loop iteration?

Thanks
 
You can create a temp table, insert all the parameters into it then loop through that - create an identity on the temp table and use that to loop through the rows.

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
Thanks. Please forgive my ignorance here - Can I insert into a temp table without encountering the same problem?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top