SELECT
context_id
,a.alias.value('(KeyValueId/text())[1]','Varchar(20)') AS 'KeyID'
,a.alias.value('(Value/text())[1]','Varchar(20)') AS 'Value'
,a.alias.query('.') AS 'Node'
FROM (
.
.
.
____________________________________________________
Deja View - The strange feeling that somewhere, sometime you've optimised this query before
How to get the best help on a forum
http://www.sqlservercentral.com/articles/Best+Practices/61537