Sqlserver
 sql >> Database >  >> RDS >> Sqlserver

Nodi TSQL Split XML

Prova qualcosa del genere:

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

L'output risultante sarebbe:

ID  (No column name)
1   <insert pk="1" />
1   <insert pk="2" />
1   <delete pk="1" />
1   <delete pk="2" />
2   <insert pk="3" />