>>Check my blog post
>>
http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/how-to-get-information-about-all-databas>>
>>I believe I do have this script there (may be even a few).
>
>I executed the one "Record Count in every table in a database". It is very slow. I am better off just to scan all my tables one by one and execute the other script which provides instant result. Is that the script you were referring to?
>
>However, when I executed "Sizes of All Tables in a Database", that one gives an instant result and provides all the fields as the script I initially provided. That one seems to be the good one to use.
This record count should be quick:
DECLARE @SQL NVARCHAR(MAX)
SET @SQL = ''
SELECT @SQL = @SQL + CHAR(13) + 'USE ' + QUOTENAME([name]) + ';
SELECT ' +QUOTENAME([name],'''') + 'as [Database Name],
SchemaName=s.name
,TableName=t.name
,CreateDate=t.create_date
,ModifyDate=t.modify_date
,p.rows
,DataInKB=sum(a.used_pages)*8
FROM sys.schemas s
JOIN sys.tables t on s.schema_id=t.schema_id
JOIN sys.partitions p on t.object_id=p.object_id
JOIN sys.allocation_units a on a.container_id=p.partition_id
GROUP BY s.name, t.name, t.create_date, t.modify_date, p.rows
ORDER BY SchemaName, TableName' FROM sys.databases
EXECUTE (@SQL)
If it's not broken, fix it until it is.
My Blog