Inserting data to xml column

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nmsreddi
    Contributor
    • Jul 2006
    • 366

    Inserting data to xml column

    HI Friends

    i am using sqlserver2005 .
    I have column in my table with xml DataType .and while i am inserting data into it ,if '&' is there in data it is giving xml parser error as

    "XML parsing: line 1, character 15, illegal name character"

    i have idea that xml parsing & is represented as 'amp' , but i cannot do that
    my requirement is to insert the data as it is.

    ex:of my insert statement is

    insert into dbo.XMLTest values ('~ABC; XXX ABC& !ABC');

    is there any alternative way to insert "~ABC; XXX ABC& !ABC" in to xml column


    Thanks
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Can you get the value into a nvarchar variable, manipulate it and store it back? Just make sure your string is a valid xml.

    -- CK

    Comment

    Working...