Sqlserver
 sql >> Base de Dados >  >> RDS >> Sqlserver

Nós XML divididos TSQL


Tente algo assim:
SELECT 
    ID, 
    XmlChanges.query('.')
FROM
    @test
CROSS APPLY
    Changes.nodes('/*') AS Nodes(XmlChanges)

A saída resultante seria:
ID  (No column name)
1   <insert pk="1" />
1   <insert pk="2" />
1   <delete pk="1" />
1   <delete pk="2" />
2   <insert pk="3" />