DB2: Using XML Cheat Sheet

Creating a database and table for storing XML data

Create a database by issuing

db2 create database xmldb 

Create a well-formed XML file and create a table with the data type of the column as ‘XML’.

db2 “create table <schema>.<table>(col <datatype>, 
col <xml datatype>)” 

Insert xml values into table, well-formed XML documents are inserted into XML type column using SQL statement ‘INSERT’.

db2 “insert into <table_name> values(value1, value2)” 

Updating XML data in a table

db2 “update <table_name> set <column>=<value> where 
<column>=<value>” 

Leave a Reply

Your email address will not be published. Required fields are marked *