sql2008 xml 读取 写入 存储过程
alter procedure p_load_stryker_xml @xml nvarchar(max) as set nocount on declare @ixml int EXEC sp_xml_preparedocument @ixml OUTPUT, @xml INSERT INTO t_dealer_out_import (id,indexid,productid,productcode,sn,barcodep,barcodes,quantity,productname,ProductGroup,ProductLine,ProductCategory,reason,dealer,dealerid,changedealerid,stockdate,deptid,dept,ProvinceId,province,hospitalid,Hospital,ordercode,price,reportdate,dealerShortName,OrderNo) SELECT * FROM OPENXML (@ixml, '/root/row',2) WITH ( id int 'id', indexid nvarchar(50) 'indexid', productid nvarchar(50) 'productid', productcode nvarchar(50) 'productcode', sn nvarchar(50) 'sn', barcodep nvarchar(50) 'barcodep', barcodes nvarchar(50) 'barcodes', quantity int 'quantity', productname nvarchar(255) 'productname', ProductGroup nvarchar(100) 'ProductGroup', ProductLine nvarchar(100) 'ProductLine', ProductCategory nvarchar(100) 'ProductCategory', reason text 'reason', dealer nvarchar(100) 'dealer', dealerid nvarchar(50) 'dealerid', changedealerid nvarchar(50) 'changedealerid', stockdate nvarchar(50) 'changedealerid', deptid nvarchar(50) 'deptid', dept nvarchar(100) 'dept', ProvinceId nvarchar(10) 'ProvinceId', province nvarchar(50) 'province', hospitalid nvarchar(50) 'hospitalid', Hospital nvarchar(50) 'Hospital', ordercode nvarchar(50) 'ordercode', price decimal(18, 2) 'price', reportdate nvarchar(50) 'reportdate', dealerShortName nvarchar(50) 'dealerShortName', OrderNo nvarchar(50) 'OrderNo' ) SELECT id,indexid,productid,productcode,dealer,dept,province,Hospital,reportdate,dealerShortName,OrderNo From t_dealer_out_import where id in ( SELECT id FROM OPENXML (@ixml, '/root/row',2) WITH ( id int 'id' ) ) EXEC sp_xml_removedocument @ixml