How do I escape double quotes in attributes in an XML String in T-SQL?

后端 未结 4 591
予麋鹿
予麋鹿 2020-12-23 13:17

Pretty simple question - I have an attribute that I would like to have double quotes in. How do I escape them? I\'ve tried

  • \\\"
  • \"\"
  • \\\\\"
4条回答
  •  鱼传尺愫
    2020-12-23 13:17

    Wouldn't that be " in xml? i.e.

    "hi "mom" lol" 
    

    **edit: ** tested; works fine:

    declare @xml xml
    
     set @xml = ''
    
    select @xml.value('(//item/@value)[1]','varchar(50)')
    

提交回复
热议问题