title: SQL Server CASE .. WHEN .. IN statement
body: <p>On SQL server 2005 I am trying to query this select statement </p>
  
  <pre><code>SELECT AlarmEventTransactionTableTable.TxnID,
         CASE AlarmEventTransactions.DeviceID
           WHEN DeviceID IN( '7', '10', '62', '58',
                             '60', '46', '48', '50',
                             '137', '139', '142', '143', '164' )
             THEN '01'
           WHEN DeviceID IN( '8', '9', '63', '59',
                             '61', '47', '49', '51',
                             '138', '140', '141', '144', '165' )
             THEN '02'
           ELSE 'NA'
         END AS clocking,
         AlarmEventTransactionTable.DateTimeOfTxn
  FROM   multiMAXTxn.dbo.AlarmEventTransactionTable 
  </code></pre>
  
  <p>It returns the error below </p>
  
  <blockquote>
    <p>Msg 156, Level 15, State 1, Line 4   Incorrect syntax near the
    keyword 'IN'.</p>
  </blockquote>
  
  <p>Please give me some advice on what could be wrong with my code.</p>