dorleta
3rd April 2020, 10:26
Hi
From one ION dataflow I want to write to a database.
from the Database connection point I call to a store procedure

EXEC update_opportunity @xmlData='[Data]';
message sync.quote

In the store procedure I try to get in variables the quote and opportunity value
What am I doing wrong?
I don“t get any value

Thanks
/**
[dbo].[update_opportunity] (@xmlData as XML)

SET NOCOUNT ON;
DECLARE @XmlDocumentHandle int;
declare @qono as varchar(9);
declare @qtno as varchar(9);

EXEC sp_xml_preparedocument @XmlDocumentHandle OUTPUT,
@XmlData;

set @qono =(SELECT ID
FROM OPENXML (@XmlDocumentHandle,
'Quote/QuoteHeader/DocumentID/ID',2)
)

set @qtno = (SELECT ID
FROM OPENXML (@XmlDocumentHandle,
'Quote/QuoteHeader/OpportunityReference/DocumentID/ID',2)
)

bhushanchanda
3rd April 2020, 18:32
Is this the right code for your stored procedure?

Are you able to compile it successfully?

Did you tried passing the XML data in SQL Server(I assumed)/Oracle directly?

You can also try something like this -

set @qono =(SELECT *
FROM OPENXML (@XmlDocumentHandle,
'Quote/QuoteHeader/DocumentID/ID',2) WITH (ID varchar(9) 'text()')
)

set @qtno = (SELECT *
FROM OPENXML (@XmlDocumentHandle,
'Quote/QuoteHeader/OpportunityReference/DocumentID/ID') WITH (ID varchar(9) 'text()')
)