Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server XML is Read Only?

Tags:

sql-server

xml

I have some XML data in a SQL Server database that I want to edit. However it appears to be marked as read only if I just try to click in the field and manually edit it. How should I go about editing the values?

like image 477
sir_thursday Avatar asked Nov 18 '25 13:11

sir_thursday


1 Answers

It appears that you are trying to edit this through SSMS - you can't do it through that. (I believe that XML fields cannot be edited in SSMS as it isn't set up to do the necessary validation, and MS didn't want people doing edits and getting errors.)

However, if you use another client, such as MS Access, to edit the table/view data, you will probably find that it can be edited.

Alternatively, you could copy the XML, and paste it into an: UPDATE TableOrViewName SET FieldName = 'Your modified XML Here' WHERE PKField = PKValue statement in a new query window. You wouldn't want to do this manually for any more than a few records.

like image 82
Monty Wild Avatar answered Nov 21 '25 05:11

Monty Wild