27,580
社区成员
发帖
与我相关
我的任务
分享
declare @Code uniqueidentifier
declare list cursor for select distinct Code from A
open list
fetch next from list into @Code
while (@@ROWCOUNT>0)
begin
Select * into #tbl From A
fetch next from list into @Code
end
close list
DEALLOCATE list
create table #tbl()
declare @Code uniqueidentifier
declare list cursor for select distinct Code from A
open list
fetch next from list into @Code
while (@@ROWCOUNT>0)
begin
insert #tbl Select * From A
fetch next from list into @Code
end
close list
DEALLOCATE list
create table @tb1( ……)
declare @Code uniqueidentifier
declare list cursor for select distinct Code from A
open list
fetch next from list into @Code
while @@fetch_status=0
begin
Select * From A
fetch next from list into @Code
end
close list
DEALLOCATE list