proc_mastrrec_hdr_upd.sql

来自「工厂采购系统,DELPHI+SQL SERVER,三层技术」· SQL 代码 · 共 56 行

SQL
56
字号

if object_id('dbo.Proc_MastrRec_hdr_Upd') is not null
drop procedure Proc_MastrRec_hdr_Upd
go

create procedure Proc_MastrRec_hdr_Upd
@action_cd char(1) = null,
@hpn varchar(18) = null,
@vendor_id varchar(10) = null,
@cpn  varchar(30) = null,
@mpn varchar(30) = null,
@model varchar(30) = null,
@UoM  char(3) = null,
@unit_Price float = null,
@Currency char(3) = null

as
begin
   if not exists(select hpn from PO_Master_Record_Hdr
	where hpn = @HPN)
	begin
		insert into PO_Master_Record_Hdr
		(
HPN,
Status,
Vendor_id,
CPN,
MPN,
MODEL,
UoM,
Unit_Price,
Currency,
Blocked
)
values
(
@HPN,
'A',
@Vendor_id,
@CPN,
@MPN,
@MODEL,
@UoM,
@Unit_Price,
@Currency,
'N'
)
end
	else
	begin
		update  PO_Master_Record_Hdr
			set unit_price = @unit_price,
			    currency = @currency
		where hpn = @hpn
end
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?