Atitit. mssql database table records and table volume statistics

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.