Using XML Datatype is SQL SERVER
The xml data type lets you store XML documents and fragments in a SQL Server database.
The below shows how to add a new column of XML datatype
ALTER TABLE Employee ADD JobHistory XML
The below shows how to Store the data in a XML column
UPDATE Employee SET JobHistory=
'< Job JobID="1" >
< CompanyName>ABC Corp< /CompanyName>
< Years>1< /Years>
< /Job>
'
WHERE EMPLOYEEID = 1
The below shows how to add a new column of XML datatype
ALTER TABLE Employee ADD JobHistory XML
The below shows how to Store the data in a XML column
UPDATE Employee SET JobHistory=
'< Job JobID="1" >
< CompanyName>ABC Corp< /CompanyName>
< Years>1< /Years>
< /Job>
'
WHERE EMPLOYEEID = 1
Comments