开发者

Firebird - update row's value in table basing on some condition

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)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜