0
使用SQL Server 2005尋找空列值
我想找到一個空列值,如果是空的話,我必須顯示爲空,否則我一定要表現出列的值
Table1
Column1
Abcd
null
efgh
lkmn
null
...
...
嘗試查詢
Select column1, case when column1 = null then 'empty' else column1 end as status from table1
Select column1, case when column1 = '' then 'empty' else column1 end as status from table1
上述查詢不起作用。
期望輸出
列1狀態
Abcd Abcd
null empty
efgh efgh
lkmn lkmn
null empty
... ...
... ...
如何使上述條件的查詢。
+1。也可以使用`COALESCE(column1,'empty')AS狀態` – devstuff 2010-12-22 04:08:31