如何在 SQL 中使用 NULL 或空字符串 [英] How to use NULL or empty string in SQL
本文介绍了如何在 SQL 中使用 NULL 或空字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何在 SQL Server 的 WHERE
子句中同时使用 NULL 和空字符串.我需要查找具有空值或空字符串的记录.谢谢.
I would like to know how to use NULL and an empty string at the same time in a WHERE
clause in SQL Server. I need to find records that have either null values or an empty string. Thanks.
推荐答案
Select *
From Table
Where (col is null or col = '')
或
Select *
From Table
Where IsNull(col, '') = ''
这篇关于如何在 SQL 中使用 NULL 或空字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文