|
Execute the following
Microsoft SQL Server T-SQL script in SSMS Query Editor to count the rows in all tables in the AdventureWorks database:
USE AdventureWorks
GO
create table #Report (TableName varchar(100), Population varchar(50))
insert #Report
exec sp_MSforeachtable @command1=" select '?', count(*) from ?"
select TableName,
Population=left(convert(varchar,convert(money, Population),1), len(convert(varchar,convert(money, Population),1)) -3)
from #Report
order by convert(int,Population) desc
drop table #Report
go
|