首页 > 数据库技术 > 详细

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

时间:2018-01-10 16:21:48      阅读:240      评论:0      收藏:0      [点我收藏+]
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 +@tablename+‘‘
   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进阶-筛选库表中数据为空的表

原文:https://www.cnblogs.com/namedL/p/8259116.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!