You need to perform two logical steps as best I can tell:
- Parse the XML - i.e. get a result set from it.
- Pivot the result set.
To get a result set from the XML, use the OPENXML function - something like the following...
DECLARE @idoc int, @doc varchar(1000);
-- the XML document
SET @doc ='
<ROOT>
<Settings>
<Setting ERName="CAPTURE_MODE_ID" Value="9" />
<Setting ERName="VEHICLE_TYPE" Value="7" />
</Settings>
</ROOT>';
-- Create an internal representation of the XML document.
EXEC sp_xml_preparedocument @idoc OUTPUT, @doc;
-- Execute a SELECT statement that uses the OPENXML rowset provider.
SELECT *
FROM OPENXML (@idoc, '/ROOT/Settings/Setting', 1)
WITH (ERName varchar(20), Value varchar(20));
..., which yields the following results:
ERName Value
--------------- -----
CAPTURE_MODE_ID 9
VEHICLE_TYPE 7
To pivot the result set without aggregation, consider the ideas presented to this end in a CALSQL blog post.