Stored Procedure to Update a 'Set' of values instead of one-at-a-time

  • I have a stored procedure that is currently doing an update based on the primary key value that is being passed in the parameter. I want to be able to send a range of primary key values in the same parameter and then do the update all in one step. Is this possible?

    Tahnks

  • Yes.

    You could provide the primary keys as a comma separated list (without blanks) and use a split string function to covert that list into a table (search for DelimitedSplit8K on this site to find an excellent performing solution).

    As a result, you'd get a table with your primary keys you could use ina join ofn your update statement.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • Great! Thanks again for another set-based solution for me, Lutz!

  • My pleasure 😀



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply