I have a OPENQUERY linking to an Oracle server that is failing. (I can't make any changes on the oracle server)

But when it returns the error string it is cut short because it returns the query in the error string and the query is longer than 4000 characters, and because ERROR_MESSAGE() is of type nvarchar(4000) the part of the error I need is missing.

Is there some way to get the remained of the string before it is truncated or is it saved some where else?

  • you can try to run the query from OPENQUERY directly in the Oracle's SQL*Plus, or you can try to reduce the SQL statement to find where the error is
    – cha
    May 20 '14 at 3:41
  • Thanks for the suggestion unfortunately this error is an intermittent error and it is only occurring when I run it in a larger script that takes about 6 hours to run through. I have tried removing all the whitespace from the query but this wasn't enough and I also tried reducing the complexity of the query just for testing to make it shorter but this got rid of the error. I think the error must be because of the load on the server but I would really like to be able to get the error message so I can see what it says...
    – user802599
    May 20 '14 at 23:21
  • What about testing for error_number()
    – cha
    May 21 '14 at 6:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.