zwei1121

博客园 首页 新随笔 联系 订阅 管理

select UserID into #Test from  dbo.User_Basic where  UserID not in (select UserID from  dbo.User_Detail)

declare my_cursor cursor
for
select UserID from #Test
open my_cursor
declare @UserID varchar(50)
fetch next from my_cursor into @UserID

while(@@fetch_status=0)
begin
insert into User_Detail(UserID) values(@UserID)
Print @UserID
fetch next from my_cursor into @UserID
end
close my_cursor
deallocate my_cursor

drop table #Test

posted on 2011-07-20 16:29  zwei  阅读(185)  评论(0编辑  收藏  举报