load xml data into sql server code example
Example: xml file sql server
ALTER PROCEDURE manageImpactItemsList
@ImpactXml,
@ProductID
AS
BEGIN
DECLARE @Handle INT;
EXEC SP_XML_PREPAREDOCUMENT(@Handle OUTPUT, @ImpactXml);
INSERT INTO ImpactItemsList_tbl(ProductID, ImpactItem, ImpactID, Answer)
SELECT X.ImpactItem, X.ImpactID, X.Answer FROM OPENXML(@Handle, '/RT/ITEM', 2)
WITH(
ImpactItem VARCHAR(50) 'ImpactItem',
ImpactID INT 'ImpactID',
Answer VARCHAR(100) 'Answer',
) AS X;
EXEC SP_XML_REMOVEDOCUMENT(@Handle);
RETURN 'SUCCESS';
END