SQL Server, Select CASE with different casting

Posted by Mathieu on Stack Overflow See other posts from Stack Overflow or by Mathieu
Published on 2010-05-13T12:32:25Z Indexed on 2010/05/13 12:44 UTC
Read the original article Hit count: 222

Filed under:
|
|
|

I want to do a select that do a cast only for a specific ID but it doesn't seems to work.

Example :

SELECT
  CASE
    WHEN(@ID <> 1) THEN Code
    WHEN(@ID = 1) THEN Cast(Code AS int)
  END Code FROM ....

Any Idea ?

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about sql