Written by:R Teachout7/3/2008 1:50 AM
Just a quick way to find the number of rows in all of your tables.
use [dbname] go set nocount on declare @cnt int declare @table varchar(128) declare @cmd varchar(500) create table #rowcount (tablename varchar(128), rowcnt int) declare tables cursor for select table_name from information_schema.tables where table_type = 'base table' open tables fetch next from tables into @table while @@fetch_status = 0 begin set @cmd = 'select ''' + @table + ''', count(*) from ' + @table insert into #rowcount exec (@cmd) fetch next from tables into @table end CLOSE tables DEALLOCATE tables select * from #rowcount order by tablename drop table #rowcount
0 comment(s) so far...