SQL Clone
SQLServerCentral is supported by Redgate
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. (http://msdn.microsoft.com/en-us/library/ms175012.aspx)%5D

USE   [AdventureWorks2008R2]



SELECT      SCHEMA_NAME( Read more

2 comments, 2,693 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,696 reads

Posted in SQL and Me on 25 December 2011