create table tmp_barCode_detail(head_guid varchar(50) ,barcode_no varchar(50) ,del_flag varchar(50)) select * into #barCode_detail from tmp_barCode_detail where 1<>1 drop table tmp_barCode_detail insert into #barCode_detail SELECT head_guid, barcode_no,del_flag FROM OPENXML(@xmldata_id, '//detail', 2) WITH (head_guid varchar(50), barcode_no varchar(50),del_flag varchar(50))
EXEC sp_xml_removedocument @XmlData_ID insert into pd_issue_barcode_lines(head_guid,barcode_no) select head_guid,barcode_no from #barCode_detail where barcode_no not in ( select a.barcode_no from #barCode_detail a, PD_ISSUE_BARCODE_LINES b where a.head_guid = b.head_guid and a.barcode_no =b.barcode_no and a.del_flag ='False' )
主要用到sp_xml_preparedocumentcreate procedure [dbo].[P_UpdateBarcodeIssueDetail_ForXml]
@XmlData ntextas
declare @XmlData_ID int
declare @head_guid varchar(50)
declare @barcode_no varchar(50)
declare @del_flag varchar(50)
EXEC sp_xml_preparedocument @XmlData_ID OUTPUT, @xmldata, ''
create table tmp_barCode_detail(head_guid varchar(50) ,barcode_no varchar(50) ,del_flag varchar(50))
select * into #barCode_detail from tmp_barCode_detail where 1<>1
drop table tmp_barCode_detail insert into #barCode_detail
SELECT head_guid, barcode_no,del_flag FROM
OPENXML(@xmldata_id, '//detail', 2) WITH (head_guid varchar(50), barcode_no varchar(50),del_flag varchar(50))
EXEC sp_xml_removedocument @XmlData_ID insert into pd_issue_barcode_lines(head_guid,barcode_no)
select head_guid,barcode_no from #barCode_detail where barcode_no not in
(
select a.barcode_no from #barCode_detail a, PD_ISSUE_BARCODE_LINES b
where a.head_guid = b.head_guid and
a.barcode_no =b.barcode_no and a.del_flag ='False'
)