Pass Multiple parameters

  • My Store proc has the where filter with an in clause

    where abc in (@xyz)

    However while executing , Can I pass multiple values?

    Exec usp.Planner @xyz = ????

  • Look at Jeff Moden's DelimitedSplit8K function. It basically converts a delimited string to a table that you could use in a join.

  • pietlinden (2/11/2015)


    Look at Jeff Moden's DelimitedSplit8K function. It basically converts a delimited string to a table that you could use in a join.

    Or instead use a Table Valued Parameter: The SQL TABLE Type: Beyond Table-Valued Parameters [/url]


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St

  • Oh, I thought that's what Jeff's code did. Guess I have more to learn than I thought!

  • You can pass comma separated string as a parameter and inside stored procedure call a function which will split comma separated string and return the result set.

  • sharonsql2013 (2/11/2015)


    My Store proc has the where filter with an in clause

    where abc in (@xyz)

    However while executing , Can I pass multiple values?

    Exec usp.Planner @xyz = ????

    As your procedure already has where filter with an in clause. Just pass multiple values as comma separated to you parameter.

    Exec usp.Planner @xyz = 'a,b,c'

    ____________________________________________________________

    AP

Viewing 6 posts - 1 through 5 (of 5 total)

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