2010-04-29 5 views
0

Je suis nouveau à SQL Server et MySQL utilisé pendant un certain temps maintenant ...requête SQL Server pour remplacer MySQL Instruction

SELECT A.acol, IF(A.acol<0,"Neg","Pos") as Column2 From Table 

Je veux faire quelque chose comme ça sur SQL Server, mais il n » t existe l'instruction IF.

Comment puis-je remplacer cela si, dans une requête SQL Server 2008?

Répondre

2
SELECT A.acol, 
    case when A.acol < 0 then 'Neg' else 'Pos' end as Column2 
From Table