sqlserver 创建游标
时间:2021-07-01 10:21:17
帮助过:4人阅读
DECLARE #point_cursor CURSOR FOR select * from #t --每条信息从头到尾的写入 -- 创建临时表 OPEN #point_cursor FETCH NEXT FROM #point_cursor INTO @col while @@fetch_status = 0 begin if not exists(select * from z_area_provider where area_id =@id and service_provider_id=@col)
begin
insert into z_area_provider(id,create_date,create_by,service_provider_id,area_id)
values(NEWID(),GETDATE(),@update_name,@col,@id)
end
FETCH NEXT FROM #point_cursor INTO @col END CLOSE #point_cursor DEALLOCATE #point_cursor drop table #t 删除临时表 end
sqlserver 创建游标
标签:varchar dealloc arc service -- 创建 serve pen after