如果一个表或两个表的表中都没有记录,我们需要将它们放入一个临时表中。
如何在SQLServer中编写下面的语句。
select Total
into #t1
from
(
select Total = 'The data did not load into customers table'
from
(
select count(*) as total
from customers
having count(*) = 0
) a
OR
select Total= 'The data did not load into Employees table'
from
(
select count(*) as total
from Employees
having count(*)=0
) a
) b
2条答案
按热度按时间smtd7mpg1#
一个简单的
not exists
结合了union all
应该做到:gpnt7bae2#
如果我没弄错的话,你可以
union all
具体如下: