As far as I remember I could do such update in MS SQL Server:
UPDATE MyTable SET MyValue = (IF SomeCondition THEN 1 ELSE 0 END)
or different way for update by using CASE:
UPDATE MyTable SET MyValue = (CASE WHEN SomeCondition1 THEN 1 ELSE 0 END)
Is any of this methods possible in Firebird? I've tried both ways but with no luck.
Thank开发者_Python百科s for answers.
Which version of FireBird are you using? I tested with 2.5 and the second one (using CASE
) works as expected.
FireBird doesn't support IF
statement in DSQL but you can use IIF
internal function, ie following works too:
UPDATE MyTable SET MyValue = iif(SomeCondition, 1, 0)
精彩评论