Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in

Archives: December 2011

SQL Server – Row count for all views / tables

Getting row count for all tables in a database is straight forward. You can display row count for all tables by joining sys.objects and sys.partitions as below:

[UPDATE: sys.partitions only shows an approximation of the number of rows. (

USE   [AdventureWorks2008R2]



SELECT      SCHEMA_NAME( Read more

2 comments, 1,845 reads

Posted in SQL and Me on 28 December 2011

SQL Server – How to identify service pack installed

Identifying current service pack installed for SQL Server can be difficult if you don’t know which command to use! Most of the time I have seen people using @@VERSION to check for SQL Server service pack level, which is not correct as it returns the service pack level of operation… Read more

9 comments, 2,061 reads

Posted in SQL and Me on 25 December 2011