This script can be used as a view to count the number of rows in all SQL tables in your database. This can be very usefull.
CREATE VIEW [dbo].[vwTableListRowCount] AS -- EXAMLE -- SELECT * FROM vwTableListRowCount ORDER BY TableName SELECT TOP 100 PERCENT O.name AS TableName, s.name AS SchemaName, I.rowcnt AS NrOfRecords FROM sysobjects AS O INNER JOIN sysindexes AS I ON O.id = I.id INNER JOIN sys.schemas AS S ON O.uid = S.schema_id WHERE I.indid IN (0, 1) AND O.xtype = 'u' AND O.[name] NOT IN ('sysdiagrams', 'dtproperties') ORDER BY O.[name] |