We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

stored procedure in sql server 2005

dsk1234
dsk1234 asked
on
Medium Priority
209 Views
Last Modified: 2012-05-11
I have a stored procedure in sql server 2005 that takes 3 input parameters that will update

a table


My requirement is to update 6 records ie

exec samplesp '1','a','x'
exec samplesp '2','b','x'
exec samplesp '3','c','x'
exec samplesp '4','d','x'
exec samplesp '5','e','x'
exec samplesp '6','f','x'

In the above, instead of calling  stored proc 6 times, is there any better way we can do this calling once and updating all 6 records

Comment
Watch Question

Bhavesh ShahLead Analyst
CERTIFIED EXPERT
Top Expert 2010

Commented:
Hi,

what yo u can do is.....

create 3 param as varchar and pass it as comma seperator....
CERTIFIED EXPERT

Commented:
Here quite a detailed description of various techniques to do this:
http://www.sommarskog.se/arrays-in-sql-2005.html
Bhavesh ShahLead Analyst
CERTIFIED EXPERT
Top Expert 2010

Commented:
Hi,

If you can share your proc den we can help you out....

Author

Commented:
without modifying existing  store proc , while executing can we achieve ?
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.