Como escapar aspas duplas em atributos em uma String XML no T-SQ
Muito simples pergunta - Eu tenho um atributo que eu gostaria de ter aspas duplas. Como faço para escapar deles? Eu tente
\ " "" \\ "E eu criei a variável @xml, tanto do tipo xml quanto do varchar (max) para todos ele
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