i have this values in my table:

id
-----    
1    
2
null
3
4
null
5

Now I want to run a command similar to the following command:

select id==null from table

And the output should be as follows:

id
-----    
false
false
true
false
false
true
false

How do?

有帮助吗?

解决方案

You can use CASE expressions:

SELECT id, 
       CASE WHEN id IS NULL THEN 'true' ELSE 'false' END AS id_Description
FROM dbo.Table1
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top