Monday, February 20, 2012

OPENXML error

Hi,
I have an SP which deals with xml. The SP receives an ntext argument that
has the xml string.
The sp_xml_preparedocument sp is called to get a handle from the ntext.
Then an OPENXML statement clubbed with an INSERT statement is executed.
Example :
INSERT INTO dpcmain.ProcessedSecurity ( FileId, SecurityId, RecordDate,
UnprocessedData )
SELECT @.FileId, SecurityId, RecordDate, UnprocessedData
FROM OPENXML (@.PSDoc,'xml/rs:data/rs:insert/z:row',0)
WITH (SecurityID integer, RecordDate varchar(128), UnprocessedData
varchar(256))
where @.PSDoc is the handle to the xml document.
We occasionally get an error in the OPENXML statement.That is okay, however,
the problem is that SQL Server DOES NOT go to the next line in the SP. In
the next line I check for @.@.error and take some action if OPENXML fails.
Is it a known issue that when OPENXML fails, the control goes out of the SP
and DOES NOT go to the next line in the SP?
Thanks in advance,
Bhasker.
Hi,
Whether or not a Stored Procedure or Trigger continues onto the next line, following an error is dependant on the type of error that is raised. Back in the days of 6.5, this did NOT depend on the Severity of the error, but I'm not sure if that has changed
with 2000.
So, the actual error that you are getting would be useful.

No comments:

Post a Comment