日期:2014-05-18 浏览次数:20484 次
DECLARE @sql NVARCHAR(max) SET @sql=' DECLARE @table TABLE(table_name VARCHAR(100),cnt INT) INSERT INTO @table ' SELECT @sql=@sql+N' SELECT TABLE_NAME='''+TABLE_SCHEMA+N'.'+TABLE_NAME+''',COUNT(1) as cnt FROM '+TABLE_SCHEMA+N'.'+TABLE_NAME+N' union all' FROM INFORMATION_SCHEMA.tables WHERE TABLE_TYPE='BASE TABLE' SET @sql=LEFT(@sql,LEN(@sql)-LEN('union all')) SET @sql=@sql+N'select * from @table where cnt> 10000 ' EXEC(@sql)
------解决方案--------------------
SELECT OBJECT_NAME(Id) FROM sysindexes WHERE indid < 2 AND rows > 10000