Q&A for scientific skepticism
-- Enter Query Title -- Enter Query Description declare @XMLDoc xml = ' <rootnode> <group> <id>1</id> <anothernode>first string</anothernode> <anothernode>second string</anothernode> </group> <group> <id>2</id> <anothernode>third string</anothernode> <anothernode>fourth string</anothernode> </group> </rootnode>' SELECT T.N.value('../id[1]', 'int') AS id, T.N.value('.', 'varchar(30)') AS anothernode FROM @XMLDoc.nodes('rootnode/group/anothernode') AS T(N)