Atitit. mssql database table records and table volume statistics 1. EXECsp_MSforeachtableEXECUTEsp_spaceused? The last method is to hide the undisclosed system stored procedure sp_MSforeachtableCREATETABLE # temp (TableNameVARCHAR (255), RowCntINT) EXECsp_MSforeachtableINSE
Atitit. mssql database table records and table volume statistics 1. EXEC sp_MSforeachtable EXECUTE sp_spaceused? The last method is to hide the undisclosed system stored procedure sp_MSforeachtable create table # temp (TableName VARCHAR (255), RowCnt INT) EXEC sp_MSforeachtable INSE
Atitit. mssql database table records and table volume statistics
1. EXEC sp_MSforeachtable "EXECUTE sp_spaceused '? '"
The last method is to hide the undisclosed system stored procedure sp_MSforeachtable.
Create table # temp (tablelename VARCHAR (255), RowCnt INT)
EXEC sp_MSforeachtable 'insert INTO # temp select ''? '', COUNT (*) FROM? '
SELECT TableName, RowCnt FROM # temp order by TableName
Drop table # temp
Since mssql6.5, Microsoft has provided two very useful system stored procedures: sp_MSforeachtable and sp_MSforeachdb, which are used to traverse each table of a database and traverse each database under DBMS management.
Author: old wow's paw Attilax iron, EMAIL: 1466519819@qq.com
Reprinted please indicate Source: http://blog.csdn.net/attilax
2. First, use the sysobjects table. 3. For more information, see
Count the records of all tables in SQLSERVER-minisunny's column-blog channel-CSDN.NET.htm