开发者

How to write IF(expr1,expr2,expr3) in mssql

开发者 https://www.devze.com 2023-01-28 08:55 出处:网络
There is IF(expr1,expr2,expr3) in my sql. 开发者_Go百科 How to accomplish it in MS SQL?You can use a CASE expression:

There is IF(expr1,expr2,expr3) in my sql.

开发者_Go百科

How to accomplish it in MS SQL?


You can use a CASE expression:

CASE WHEN expr1 THEN expr2 ELSE expr3 END

By the way, this syntax isn't SQL Server specific - it also works in MySQL and most other databases.

0

精彩评论

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