sql进阶-筛选库表中数据为空的表

Posted namedL

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql进阶-筛选库表中数据为空的表相关的知识,希望对你有一定的参考价值。

use 库名
go
declare @tablename nvarchar(100)
declare @sql nvarchar(2000)
declare @count int
declare @a int
declare cur_c cursor for
select name from sysobjects where xtype=U and status>=0
open cur_c
fetch next from cur_c into @tablename
while @@fetch_status = 0
begin
   set @sql=select @a=count(*) from [email protected]+‘‘
   exec sp_executesql @sql,N@a int output,@count output
   if @count=0
   print @tablename
   fetch next from cur_c into @tablename
end
close cur_c
deallocate cur_c

 

以上是关于sql进阶-筛选库表中数据为空的表的主要内容,如果未能解决你的问题,请参考以下文章