stored procedure in sql server 2005

Posted on 2011-04-21
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

Question by:dsk1234
    LVL 19

    Expert Comment

    by:Bhavesh Shah

    what yo u can do is.....

    create 3 param as varchar and pass it as comma seperator....
    LVL 22

    Expert Comment

    by:Nico Bontenbal
    Here quite a detailed description of various techniques to do this:
    LVL 19

    Expert Comment

    by:Bhavesh Shah

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

    Author Comment

    without modifying existing  store proc , while executing can we achieve ?
    LVL 22

    Accepted Solution

    If the stored procedure is designed to update on record there is no way of telling it to update 6 records at 1 go without changing the stored procedure.

    Featured Post

    Live: Real-Time Solutions, Start Here

    Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

    Join & Write a Comment

    In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
    In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now