IF statement error

Posted by Jasl on Stack Overflow See other posts from Stack Overflow or by Jasl
Published on 2010-05-26T06:53:25Z Indexed on 2010/05/26 7:01 UTC
Read the original article Hit count: 251

Filed under:
|

I have the following columns in TableA

TableA  
Column1 varchar  
Column2 int  
Column3 bit  

I am using this statement

IF Column3 = 0
  SELECT Column1, Column2 FROM 
  TableA WHERE
  Column2 > 200
ELSE
  SELECT Column1, Column2 FROM 
  TableA WHERE
  Column2 < 200

But the statment does not compile. It says Invalid Column Name 'Column3'

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server