SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[Orderinterface]
as
create table #a --创建临时表#a储存查询的结果集
(
ID int IDENTITY (0,1),--自增列从0开始每次增加1
o_id int,--医药网订单ID
o_buyer_internal_code varchar(256),--采购客户ERP内码
o_add_time datetime, --订单创建时间
o_note varchar(512),--订单备注
);
--将查询结果集插入到临时表中
INSERT INTO #a select o_id,o_buyer_internal_code,o_add_time ,o_note from mph_order
where is_fetch = '否'
--创建临时变量
declare
@ii int,--循环更新变量
@i int,
@jj int,--循环更新变量
@j int,
@Ordermaxid int,--千方OrderIndex表最大id
@oo_id int--医药网订单id
set @ii=0 --从0开始