Single quotes is not taken in the XML

  • How to insert this value into the XML column without changing anything in the XML format.

    DECLARE @XML TABLE (fldID INT, fldXML XML)

    INSERT INTO @XML (fldID, fldXML)

    SELECT 1,'

    '

    SELECT * FROM @XML

    The Problem here is, it is not taking the single quotes (') values in the XML part.

  • You need to escape the apostrophe you want in the field with another apostrophe, and since it is a string literal, it needs to be enclosed in apostrophes. The following will do as you need.

    DECLARE @XML TABLE (fldID INT, fldXML XML)

    INSERT INTO @XML (fldID, fldXML)

    SELECT 1,''''

    SELECT * FROM @XML

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply