Broj zapisa u tabelama (broj zapisa)
if object_id('_tabele') is null
begin
create table _tabele
(name char (100),
broj int)
end
declare @nesto char(100),
@sql varchar(max)
declare xPoz cursor local fast_forward for
select name from sysobjects where xtype = 'U'
open xPoz
fetch from xPoz into @nesto
while @@fetch_status = 0
begin
set @sql = ' set @i = (select count(*) from ' + rtrim(@nesto) + ') insert into _tabele (name, broj) values('''+ rtrim(@nesto) +''', @i) '
print @sql
fetch from xPoz into @nesto
end
close xPoz
deallocate xPoz