-- SQL Server tables and row counts
declare tables_cursor cursor for
select name from sysobjects where xtype='U'
declare @table_name sysname
open tables_cursor
fetch next from tables_cursor INTO @table_name
while @@fetch_status = 0
begin
exec sp_spaceused @table_name
fetch next from tables_cursor INTO @table_name
end
close tables_cursor
deallocate tables_cursor