本文介绍了使用isnull和coalesce重写SQL查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
rewrite below incorrect statement in two ways using isnull and coalesce select * from Test_Table where Test_ID=null
我尝试过:
What I have tried:
rewrite below incorrect statement in two ways using isnull and coalesce select * from Test_Table where Test_ID=null推荐答案
SELECT TOP 10 * FROM Google WHERE (NULL, Coalesce) IN SearchTerms
不清楚你的内容问题是。但这里有一个关于如何使用COALESCE和ISNULL函数的例子。 Not clear what your question is. But here an example on how to use COALESCE and ISNULL function. --if first column/Test_ID is null, use value from second column which is '' SELECT * FROM Test_Table WHERE COALESCE(Test_ID, '') = '' --if Test_ID is null, return '' SELECT * FROM Test_Table WHERE ISNULL(Test_ID,'') = ''
在这里你可以找到更多关于上述功能的信息。 COALESCE(Transact-SQL)| Microsoft Docs [ ^ ] 在SQL Server中的COALESCE和ISNULL之间进行决策 [ ^ ]
更多推荐
使用isnull和coalesce重写SQL查询
发布评论