I need use case condition in sql server, the datatype is money, the condition is money>= 100, here is my code:
insert into table1
( Col1,
Col2,
Col3
)
select
ColA,
ColB,
case ColC when ColC >=100 then 'Y' else 'N' end
I got an error: Incorrect syntax near ‘>’. How do I compare money in sql? Thanks for your help.
Use
You are mingling the two forms of the
CASEexpression (searched and simple). You would only useCASE ColC ...when all the match expressions are to have an=comparison on them (and then don’t specify the operator explicitly).