相关疑难解决方法(0)

为什么在 SQL Server 2012 中查询结果集为空会出错?

在 MS SQL Server 2012 中运行以下查询时,第二个查询失败,但第一个查询失败。此外,在没有 where 子句的情况下运行时,两个查询都将失败。我不知道为什么两者都会失败,因为两者都应该有空的结果集。任何帮助/见解表示赞赏。

create table #temp
(id     int primary key)

create table #temp2
(id     int)

select 1/0
from #temp
where id = 1

select 1/0
from #temp2
where id = 1
Run Code Online (Sandbox Code Playgroud)

sql-server sql-server-2012

33
推荐指数
2
解决办法
7031
查看次数

标签 统计

sql-server ×1

sql-server-2012 ×1