非常简单的问题 - 我有一个属性,我想在其中添加双引号。如何转义它们?我试过了
- \"
- “”
- \\"
我已经为所有这些都设置了 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