Delcare variable for Multiple values paramter in SP ???

  • Hi

    i get an error when I show multiple values in the parameter

    Do I declare the variable differently in the SP?

    ...@Code varchar(10)

    ,@Days varchar(10)

    ,@Begin VARCHAR(10)

    , @End varchar(10)

    , @Zip varchar(1000) Zip is the only parameter to accept multiple values..

    the where clause is like....

    where.....

    AND dbo.Address.Zip in (@Zip)

  • What specific error do you get?

    Forget that - have a look here[/url]

    🙂


    I'm on LinkedIn

  • Yes, read this article. I had to do learn same thing regarding multi valued params and stored procs. Using the JOIN and then in the stored proc code, use a split string function when values are passed in. something like:

    ld.ORIGINCITY IN (select * from [dbo].[fn_SplitStringList](@OriginCity)) Can search for a splitstring function in google, there are plenty of them.

  • Michael_Garrison (12/5/2013)


    Yes, read this article. I had to do learn same thing regarding multi valued params and stored procs. Using the JOIN and then in the stored proc code, use a split string function when values are passed in. something like:

    ld.ORIGINCITY IN (select * from [dbo].[fn_SplitStringList](@OriginCity)) Can search for a splitstring function in google, there are plenty of them.

    And you can find the best (no-CLR) splitting function in here: http://www.sqlservercentral.com/articles/Tally+Table/72993/

    Read the article and the comments for the best performance and test it yourself.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • What's the error?

    When you pass a multivalue parameter you have to do a

    =join(Parameters!PraramName.Value,",")

    I always forget this step, that and forgetting to make my receiving SP variable large enough to hold all the values.

  • Steven.Howes (12/6/2013)


    What's the error?

    When you pass a multivalue parameter you have to do a

    =join(Parameters!PraramName.Value,",")

    I always forget this step, that and forgetting to make my receiving SP variable large enough to hold all the values.

    Wasn't this a new feature with SSRS 2008? IIRC, there was no other way to do this than splitting the string in the stored procedure with SSRS 2005, so if the OP is still using 2005, he'll have to go that route.

    Jason Wolfkill

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

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