Using CASE select in a stored procedure

  • Hey guys. Does anyone know how I can use case select in a stored procedure to check for multiple criteria in a table? Here is an example of what I'm trying to do.

    CASE ClientBoxNumber WHEN '0096028'  OR '0096076' THEN '0096064' END

    What is the correct syntax?

  • (CASE

    WHEN CLIENTBOXNUMBER IN ('0096028', '0096076') THEN '0096064'

    ELSE ''

    END)

     

  • rharma...was spot on...but just wanna make things perfect...

    SELECT CASE WHEN CLIENTBOXNUMBER IN ('0096028', '0096076')

                        THEN  '0096064'

     

  • sorry mate pblm with backspace in my keyboard

    SELECT CASE WHEN CLIENTBOXNUMBER IN ('0096028', '0096076')

                        THEN  '0096064'

                         ELSE

                END  as 'ColumnName'

    FROM    TableName

     

  • Thanks guys!

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

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