Click here to Skip to main content
15,905,967 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi.. I have little knowledge on XML. I have a table with data ( am using SQL Server 2008 R2). Now I added a new xml column. I want to update the table with an xml file that I have created. Can anyone help me with this.

Thanks in advace!
Posted

1 solution

I've done this programmatically, using a SQL data source. You have to use parameterized queries, though; you cannot embed the data in your command (which is a Bad Idea anyway.) Use a parameter of type lSqlDbType.Xml, set the parameter's Value to your XML, and execute the insert. If you are updating using a file, I think you can load the file into an XDocument object and set that as the parameter's value.

I am not sure how to update an XML column using Sql Manager, though I suspect there is a way to import a file into a variable and pass that as a parameter.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900