declare t1 cursor for select top 2 name from sysobjects
declare t2 cursor for select top 2 name from syscolumns
open t1
declare @n1 sysname,@n2 sysname
fetch next from t1 into @n1
while @@fetch_status=0 --第一层循环
begin
print @n1
open t2
fetch next from t2 into @n2
while @@fetch_status=0 --第一层循环
begin
print ' '+@n2
fetch next from t2 into @n2
end
close t2
fetch next from t1 into @n1
end
close t1
deallocate t1
deallocate t2