This site is a way for me to share photos and blog posts.

The blog will not be a diary, but instead a way of storing technical solutions and information.

As a professional computer programmer (and part time DBA/SysAdmin) it is a daily occurrence that I need to figure out technical solutions. And being human, I regularly forget what those solutions were.

So the blog is a way for me to quickly find the answer I've already worked out once, and hopefully other people on the web will discover them and find the information useful.

It will not be regularly updated!

Latest Blog...

TSQL XML Manipulation

How to change XML data via TSQL

Modifying XML data via TQL can be done using the following .modify commands...

To insert a new node/attribute...

UPDATE MyTable SET MyXml.modify('insert <item>new</item> as first into (/root)[1]')
UPDATE MyTable SET MyXml.modify('insert <item>new</item> as last into (/root)[1]')
UPDATE MyTable SET MyXml.modify('insert <item>new</item> after (/root/item[1])[1]')
UPDATE MyTable SET MyXml.modify('insert <item>new</item> before (/root/item[1])[1]')
UPDATE MyTable SET MyXml.modify('insert attribute attr {"new"} into (/root/item[1])[1]')

To change text/attribute in a node...

UPDATE MyTable SET MyXml.modify('replace value of (/root/item[1]/text())[1] with "new"')
UPDATE MyTable SET MyXml.modify('replace value of (/root/item[1]/@attr)[1] with "new"')

To delete a node/attribute/text...

UPDATE MyTable SET MyXml.modify('delete /root/item[1]')
UPDATE MyTable SET MyXml.modify('delete /root/item[1]/@attr')
UPDATE MyTable SET MyXml.modify('delete /root/item[1]/text()')
Added 09/07/2025 09:58

Contact...

In the highly unlikely event you want to get in touch please email