select query problem

Results 1 to 3 of 3

Thread: select query problem

  1. #1
    Join Date
    Dec 1969

    Default select query problem

    Hello,<BR>I am calling a stored proc from a page which contains a parameter @para1<BR>from the page i am setting the parameter as<BR>@para1 = "US,UK,AU" and passing @para1 to the stored proc<BR>In the stored proc I have given the query as <BR>select * from CtyEx where FTC IN (@para1)<BR>but this does not give me the correct query.<BR>Any idea whats wrong<BR>Thanks a lot<BR>knz

  2. #2
    Join Date
    Dec 1969

    Default RE: select query problem

    To get SQL to do what you want for a string you need The parameter to be "&#039;US&#039;,&#039;UK&#039;,&#039;AU&#039;"<BR> <BR>Now that needs to be built on the ASP page<BR><BR><BR><BR>

  3. #3
    Join Date
    Dec 1969

    Default did you test this procedure in

    query analyzer? I don&#039;t think you can actually pass parameters for an in statement and just query like that. I think you have to pass the parameter, build the SQL into a string and execute it. Also, the example you show you are passing the parameter string without the single quotes, proper syntax for the in statement when dealing with strings would be:<BR><BR>select * from CtyEx where FTC IN (&#039;US&#039;,&#039;UK&#039;,&#039;AU&#039;)<BR> <BR>So you&#039;ll have to find a way get the data in that format before you execute it in the SP. This article may help:<BR><BR>A derivative of method 2 or three will probably work if you cast the input array to varchar as you insert into the temp table.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts