multiple values when exec sp | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

multiple values when exec sp

how can I insert multiple values when i EXE sp.
like say if i execute sp test
exec test 1
i want to insert multiple values for the same field when i exec test? Thanks!
"He laughs best who laughs last"
I mean I want to give diff values for a parameter at one time when executing can i do tht Thanks!
"He laughs best who laughs last"
When you execute a stored procedure, you either have to declare a cursor that goes and fetches items from a table and manipulates it accordingly. You can also create a counter that gets incremented within a while loop, but it really depends on your needs. Keep in mind that stored procedures are mere T-SQL statements put together. – Tahsin
You can take help of dynamic SQL also here. Satya SKJ
Contributing Editor & Forums Moderator
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
You can also use a permanent staging table, where you insert the values, then you let the stored procedure pick up the values from that table. Make sure you have a some sort of session identifier to keep things tidy when the procedure is executed from parallel connections, plus a clean-up routine.
you can also consider CSV exec test ‘1,3,4,7’ ——
> KH <
<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by khtan</i><br /><br />you can also consider CSV<br /><br />exec test ‘1,3,4,7’<br /><br />——<br />&gt; KH &lt;<br /><hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote"><br />Provided that it should be split inside the stored Procedure [<img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ />]<br /><br />Madhivanan<br /><br />Failing to plan is Planning to fail