数据库建立完毕后,应首先生成每个表的CRUD存储过程操作。
其它函数后续再进行开发。
IF OBJECT_ID(N'SpUpdateHQOutOrder') IS NOT NULL
DROP PROC SpUpdateHQOutOrder
GO
CREATE PROC SpUpdateHQOutOrder
@hoor_code nvarchar(50),
@deal_code varchar(15),
@hoor_date datetime,
@in_date datetime,
@make_code nvarchar(30),
@order_date datetime,
@VeriPersonCode nvarchar(30),
@audit_date datetime,
@is_do tinyint,
@state tinyint,
@flag tinyint,
@u_id char(15),
@do_person nvarchar(30),
@do_date datetime,
@do_suggest nvarchar(100),
@upload_date datetime,
@remark nvarchar(100),
@ware_code char(10),
@order_type tinyint
as
declare @hoor_code_old nvarchar(50)
declare @deal_code_old varchar(15)
declare @hoor_date_old datetime
declare @in_date_old datetime
declare @make_code_old nvarchar(30)
declare @order_date_old datetime
declare @VeriPersonCode_old nvarchar(30)
declare @audit_date_old datetime
declare @is_do_old tinyint
declare @state_old tinyint
declare @flag_old tinyint
declare @u_id_old char(15)
declare @do_person_old nvarchar(30)
declare @do_date_old datetime
declare @do_suggest_old nvarchar(100)
declare @upload_date_old datetime
declare @remark_old nvarchar(100)
declare @ware_code_old char(10)
declare @order_type_old tinyint
DECLARE hoor_code_cursor CURSOR FOR
SELECT hoor_code FROM TMP_tb_HQ_Out_Order
OPEN hoor_code_cursor
FETCH NEXT FROM hoor_code_cursor
INTO @hoor_code
WHILE @@FETCH_STATUS = 0
BEGIN
UPDATE tb_HQ_Out_Order SET state = 0 WHERE hoor_code = @hoor_code
FETCH NEXT FROM hoor_code_cursor
INTO @hoor_code
END
CLOSE hoor_code_cursor
DEALLOCATE hoor_code_cursor
UPDATE tb_HQ_Out_Order
SET [hoor_code] = @hoor_code
,[deal_code] = @deal_code
,[hoor_date] = @hoor_date
,[in_date] = @in_date
,[make_code] = @make_code
,[order_date] = @order_date
,[VeriPersonCode] =@VeriPersonCode
,[audit_date] = @audit_date
,[is_do] = @is_do
,[state] = @state
,[flag] = @flag
,[U_ID] = @u_id
,[do_person] = @do_person
,[do_date] = @do_date
,[do_suggest] = @do_suggest
,[upload_date] = @upload_date
,[remark] = @remark
,[ware_code] = @ware_code
,[order_type] = @order_type
WHERE hoor_code = @hoor_code