DECLARE @table TABLE ( yourXML XML ) DECLARE @xml XML SET @xml = ( SELECT TOP 10 * FROM sys.objects FOR XML RAW, TYPE ) -- Spin up some dummy XML INSERT INTO @table SELECT @xml SELECT t.*, r.c.query('.'), r.c.value('@name', 'SYSNAME') AS tableName, r.c.value('@object_id', 'INT') AS objectId FROM @table t CROSS APPLY t.yourXML.nodes('row') r(c)