最佳答案
非常简单的问题-我有一个属性,我想有双引号。我怎么才能摆脱他们?我试过了
我已经为所有这些变量设置了 xml 类型和 varchar (max)的@xml 变量。
declare @xml xml --(or varchar(max) tried both)
set @xml = '<transaction><item value="hi "mom" lol"
ItemId="106" ItemType="2" instanceId="215923801" dataSetId="1" /></transaction>'
declare @xh int
exec sp_xml_preparedocument @xh OUTPUT, @xml
insert into @commits --I declare the table, just removed it for brevity
select
x.*
from openxml(@xh,'/transaction/item')
WITH (
dataItemId int,
dataItemType int,
instanceId int,
dataSetId int,
value varchar(max)
) x