Anda dapat menghancurkan XML menggunakan fungsi node:
CREATE PROC ShredXML (@x xml)
AS BEGIN
INSERT INTO TBL_TARGET (Name, Color)
SELECT
x.y.value( 'Name[1]', 'VARCHAR(20)' ) AS Name,
x.y.value( 'Color[1]', 'VARCHAR(20)' ) AS Color
FROM @x.nodes('cars/car') x(y)
END
exec ShredXML @x = N'<cars><car><Name>BMW</Name><Color>Red</Color></car><car><Name>Audi</Name><Color>Green</Color></car></cars>'