This works should show you how to do it
Bryan
declare @Tablename varchar(400)
declare @x varchar(200)
declare curtable cursor
for
select name
from sysobjects
where type='U'
order by name
open curtable
fetch next
from curtable
into @x
set @x='select count(*) from '+@Tablename
print @x
exec (@x)
while @@FETCH_STATUS=0
begin
set @x='select count(*) from '+@Tablename
print @x
exec (@x)
fetch next
from curtable
into @Tablename
end
close curtable
deallocate curtable