SQL Server 计算表记录数、当前自增值和占用空间 无 SELECTTableName = obj.name,TotalRows = prt.rows,Identity_Current=IDENT_CURRENT(obj.name),[SpaceUsed(KB)] = SUM(alloc.used_pages)*8FROM sys.objects objJOIN sys.indexes idx on obj.object_id = i
SQL Server 计算表记录数、当前自增值和占用空间SELECT TableName = obj.name, TotalRows = prt.rows,Identity_Current=IDENT_CURRENT(obj.name), [SpaceUsed(KB)] = SUM(alloc.used_pages)*8 FROM sys.objects obj JOIN sys.indexes idx on obj.object_id = idx.object_id JOIN sys.partitions prt on obj.object_id = prt.object_id JOIN sys.allocation_units alloc on alloc.container_id = prt.partition_id WHERE obj.type = 'U' AND idx.index_id IN (0, 1) GROUP BY obj.name, prt.rows ORDER BY TableName
声明:本网页内容旨在传播知识,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。TEL:177 7030 7066 E-MAIL:11247931@qq.com