Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003
    Posts
    2

    Unanswered: Beginner looking for help

    Hi All,

    I'm not very good at SQL but I want to finish my ASP project and have run into a little problem. I have a variable that I formatted represent a nice comma delimited character list with all "words" in single quotes ('A','B','C'). I was going to pass this variable to a SELECT statement -

    SELECT col FROM table WHERE item IN (<my variable>)

    Am I doing this right?

    Thanks!

    B

  2. #2
    Join Date
    Oct 2003
    Location
    Switzerland
    Posts
    140
    I don't think this will work. The IN clause will try to match all values of column ITEM with the complete string that your variable represents. There are a lot of ways to handle this, one would be to use dynamic SQL. What database are you working with ?

    Another would be to use specific functions that allow to search for a character (pattern) within another string. Again, the solution will depend on your database.

  3. #3
    Join Date
    Oct 2003
    Posts
    2
    Originally posted by cvandemaele
    I don't think this will work. The IN clause will try to match all values of column ITEM with the complete string that your variable represents. There are a lot of ways to handle this, one would be to use dynamic SQL. What database are you working with ?

    Another would be to use specific functions that allow to search for a character (pattern) within another string. Again, the solution will depend on your database.
    Thanks. I learned the dynamic SQL way last night shortly after posing this.

    I appreciate your resonse!

Posting Permissions

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