Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Total records Expand / Collapse
Author
Message
Posted Tuesday, April 08, 2008 1:41 PM


SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Thursday, April 03, 2014 7:34 AM
Points: 448, Visits: 402
Hi All,

I have xyz database which is containing 100 user table. Is there any script which I can use to get total number of records in user table seperatly.
Urgent help would be appreciable.

Regards,
Austin
Post #481852
Posted Tuesday, April 08, 2008 2:06 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, November 12, 2013 8:44 AM
Points: 1,073, Visits: 6,334
Here's one simple way to do that. Just copy-and-paste the results into another query window.

USE MyDatabase

SELECT 'SELECT COUNT(*), ''' + name + ''' FROM ' + name FROM sys.tables

Or you could look at using the stored procedure sp_MSforeachtable.

Post #481871
Posted Tuesday, April 08, 2008 2:11 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 9:53 PM
Points: 7,084, Visits: 14,679
Todd Engen (4/8/2008)
Here's one simple way to do that. Just copy-and-paste the results into another query window.

USE MyDatabase

SELECT 'SELECT COUNT(*), ''' + name + ''' FROM ' + name FROM sys.tables

Or you could look at using the stored procedure sp_MSforeachtable.



Or - right-click on the database, Reports, Standard Reports, Disk Usage by Table (it also includes the record counts and then some).


----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
Post #481873
Posted Tuesday, April 08, 2008 7:19 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, November 12, 2013 8:44 AM
Points: 1,073, Visits: 6,334
Keep in mind those reports are only available if Service Pack 2 is installed.



Post #481965
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse