sqlserver通过查询表记录取得记录总数的存储过程怎么书写啊。
我想从系统表sysobjects里面取得表名,再使用selectcount(1)查询记录总数,这个存储过程怎么写啊,谢谢...
我想从系统表sysobjects里面取得表名,再使用select count(1)查询记录总数,这个存储过程怎么写啊,谢谢
展开
展开全部
你是说所有表的总记录数吗?给你个样例你看下有没有帮助
SELECT p.object_id,OBJECT_NAME(p.object_id),p.rows,t.*
FROM sys.partitions AS p
INNER JOIN sys.tables AS t ON p.[object_id] = t.[object_id]
INNER JOIN sys.schemas AS s ON t.[schema_id] = s.[schema_id]
WHERE p.index_id IN (0, 1)
AND t.type='U'
SELECT p.object_id,OBJECT_NAME(p.object_id),p.rows,t.*
FROM sys.partitions AS p
INNER JOIN sys.tables AS t ON p.[object_id] = t.[object_id]
INNER JOIN sys.schemas AS s ON t.[schema_id] = s.[schema_id]
WHERE p.index_id IN (0, 1)
AND t.type='U'
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询