Friday, February 24, 2012

IIF PROBLEM

in my table if ProductPrices_ID >15 then I want to change this field else
i want it to not change.
i wrote that code but it returns an error. how can i fix it ?
SELECT iif( ProductPrices_ID > 15 ; 0 ;ProductPrices_ID ) as pele FROM
ProductPricesThere is no IIF in T-SQL. For a comparable expression, look up CASE in SQL
Server Books Online.
Anith|||SELECT pele = CASE
WHEN ProductPrices_ID > 15 THEN 0
ELSE ProductPrices_ID
END
FROM ProductPrices
Coming from Access? (There is no IIF in SQL Server.) This article might
help:
http://www.aspfaq.com/2214
"Savas Ates" <savas@.indexinteractive.com> wrote in message
news:u2qnFnr6FHA.1248@.TK2MSFTNGP14.phx.gbl...
> in my table if ProductPrices_ID >15 then I want to change this field
> else i want it to not change.
> i wrote that code but it returns an error. how can i fix it ?
> SELECT iif( ProductPrices_ID > 15 ; 0 ;ProductPrices_ID ) as pele FROM
> ProductPrices
>
>

No comments:

Post a Comment