I have an XML column in a table. This column is called UserDef. The Xml looks like this:
<UserDefs>
<UserDef id="EmpNum">002</UserDef>
<UserDef id="EmpDept">AUT</UserDef>
<UserDef id="EmpName">XYZ ABC</UserDef>
<UserDef id="EmpHireDate">2009-11-01T23:59:00-06:00</UserDef>
</UserDefs>
What should the query look like to return a result like this:
Column1 Column2
--------------------
EmpNum 002
EmpDept AUT
EmpName XYZ ABC
EmpHireDate 2009-11-01 23:59:00
Thank you.
consider to use proper length for varchar/nvarchar type for your real data and also you will need to convert date value properly
if we need to select from table: