Transact-SQL (MSSQL) ::

Query XML in SQL

+15 Transact-SQL (MSSQL) +5 XML

There is a table called #Orders with the data structure below.

#Orders
ID CustomerID DeliveryInstructions ExtraProperties
INT INT VARCHAR(100) XML

The 'ExtraProperties' XML column will have random data that will resemble the example below:

<properties>
	<property name="size">Medium</property>
	<property name="color">Blue</property>
	<property name="type">2</property>
</properties>

... write a query that will yield the following results:

#Sample Result
ID CustomerID DeliveryInstructions Color Size Type
123 456 Leave at front desk! Blue Medium 2

The "Color" and "Size" columns are strings and the "Type" column is an integer.