Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    162

    Unanswered: CASE statement using wildcard

    im trying to use wildcard in CASE statement with no luck.

    im use this:

    SELECT CASE tb001
    WHEN '%price%' then 'Price'
    ELSE 'No price'

    the colum is varchar

    The expected result would be 'Price' in every row that contains price (with wildcard around) but every line shows 'No price'
    Everything works fine if i don't use wildcard and put in the whole string.

    thx in advance //Mr

  2. #2
    Join Date
    Nov 2003
    Posts
    2,934
    Provided Answers: 12
    Try (not tested)
    Code:
    SELECT 
      CASE 
         WHEN tb001 like '%price%' then 'Price'
         ELSE 'No price'
      END
    FROM ....

  3. #3
    Join Date
    Mar 2004
    Posts
    162
    works like charm... thx alot

Posting Permissions

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