代码如下:
select a.name AS name,b.rows AS rows INTO #Temp1
from db_tank.dbo.sysobjects a LEFT JOIN db_tank.dbo.sysindexes b
ON( a.id=b.id ) WHERE a.type='u' ORDER BY b.rows DESC
SELECT name,max(rows) FROM #Temp1 GROUP BY NAME ORDER BY max(rows) DESC
DROP TABLE #Temp1
---说明:db_tank即你要查询表记录行数的库。
SELECT DISTINCT ('DELETE FROM '+NAME) FROM #Temp1 WHERE NAME NOT IN
('Primary_StuEva_SportsRuleItem1',
'Primary_StuEva_SportsRuleItem2',
'StuEva_SportsRuleItem2',
'StuEva_SportsRuleItem1',
'System_Operations',
'System_Dict',
'System_FunctionImage',
'Accounts_Permissions',
'Primary_StuEva_SportsRuleItemTypes',
'Primary_StuEva_SportsRuleGradeItemType',
'System_Fields',
'Primary_StuEva_SportsRuleMainItem',
'StuEva_SportsRuleItemTypes',
'Accounts_PermissionCategories',
'System_UserLoginLog',
'StuEva_SportsRuleDesc',
'System_BaseInfoSet',
'StuEva_SportsRuleMainItem',
'Accounts_Users',
'Accounts_Users',
'Ground_BaseSet',
'Accounts_Users')
您可能感兴趣的文章:
统计sql server用户数据表大小(记录总数和空间占用情况)的代码
查询sql server中所有数据表的记录行数与表空间大小的代码(推荐)
sql 查询所有表的记录数的三种实现方法