Amit Kumar Singh

Amit Kumar Singh

  • 399
  • 4k
  • 202.5k

Conversion From OpenXML to Nodes in Sql

Sep 15 2016 12:36 PM
ALTER PROCEDURE [dbo].[USP_TestUpdateCCLogCards]
(
@xml varchar(max)
)
as
begin
BEGIN TRY
DECLARE @Doc int
exec sp_xml_preparedocument @Doc OUTPUT,@xml
update c
set c.CardNo = XMLProdTable.card
--select p.Card,p.PaymentID,XMLProdTable.paymentid
FROM OPENXML(@Doc, 'payments/data', 1)
WITH (
CustCardID Int,
card varchar(2000)
) XMLProdTable
INNER JOIN CCLOG c
ON c.LogID = XMLProdTable.CustCardID
EXEC sp_xml_removedocument @Doc

Answers (2)