Amit Kumar Singh

Amit Kumar Singh

  • 401
  • 4k
  • 202k

Using Nodes() Method in Sql Server

Sep 22 2016 12:58 PM
DECLARE @xmlDataHandle INT
EXEC Sp_xml_preparedocument
@xmlDataHandle output,
@XmlSourceData
UPDATE source
SET status = Cast(_xmlPayment.xmlstatus AS BIT)
FROM OPENXML(@xmlDataHandle, '/Sources/Source', 2)
WITH( xmlstatus BIT '@status',
xmlid VARCHAR(50) '@id' )_xmlPayment
WHERE source.sourceid = Cast(_xmlPayment.xmlid AS INT)
EXEC Sp_xml_removedocument
@xmlDataHandle
SELECT '1'
 
 
Convert this query using Nodes() Method of Sql Server instead of Openxml 

Answers (1)