h_baqery
سه شنبه 07 اسفند 1386, 11:27 صبح
من برای این کار دستور زیر رو نوشتم البته درsql2000 ولی درست کار نمی کنه .
بدون rowcount هم نوشتم ولی نشد لطفا راهنمایی کنید .
declare @count varchar(100)
declare @q varchar(500)
declare @n varchar(200)
declare @u varchar(200)
declare c cursor local for
select t.name,u.name from sysobjects t inner join sysusers u on t.uid = u.uid
where xtype = 'U'
order by t.name
open c
fetch next from c into @n,@u
while @@fetch_status = 0
begin
execute('select count(*) from '+@u+'.'+@n)
if @@rowcount <> 0
begin
print @n
print @@rowcount
end
fetch next from c into @n,@u
end
بدون rowcount هم نوشتم ولی نشد لطفا راهنمایی کنید .
declare @count varchar(100)
declare @q varchar(500)
declare @n varchar(200)
declare @u varchar(200)
declare c cursor local for
select t.name,u.name from sysobjects t inner join sysusers u on t.uid = u.uid
where xtype = 'U'
order by t.name
open c
fetch next from c into @n,@u
while @@fetch_status = 0
begin
execute('select count(*) from '+@u+'.'+@n)
if @@rowcount <> 0
begin
print @n
print @@rowcount
end
fetch next from c into @n,@u
end