declare @xmlText xml declare @club varchar(50) DECLARE @idoc int set @xmlText = (select doc from openrowset(bulk 'D:\RF_Integration\Code\Import\RF.Integration.Import.BusinessLogic\bin\Debug\ModifiedPackageFiles\golf_b6dd63fb30f84a9b941a9cdcbbacb30f_201209041607[007-004].xml',single_blob) as t(doc)) EXEC sp_xml_preparedocument @idoc OUTPUT,@xmlText set @club='golf' insert into [dbo].Address_Temp([AddressType] ,[Country],[PostalCity] ,[PostalNumber],[Street],[CO_Address],[PersonID],[PersonNum],[PersonOptType]) select [AddressType] ,[Country],[PostalCity] ,[PostalNumber],[Street],[CO_Address],[PersonID],[PersonalNumber] as [PersonNum],'Insert' as [PersonOptType] from openxml(@Idoc,'/persons/InsertRecord/Person/Addresses/Address',2) With( [AddressType] varchar(50), [Country] varchar(50), [PostalCity] varchar(50), [PostalNumber] varchar(50), [Street] varchar(50), [CO_Address] varchar(50), [PersonId] varchar(50) ..//..//PersonId',--(此处应该为单斜杠,应为blog编辑器写单斜杠有问题,所以将其写为双斜杠) [PersonalNumber] varchar(50) '..//..//
转载于:https://www.cnblogs.com/Qiaoyq/archive/2012/09/04/2670847.html