How to suppress SELECT returned messages

  • I have a SELECT statement (using and OPENQUERY and a Linked Server) that if the tablename is not found it returns an "OLE DB provider "IBMDA400" for linked server "Bank08_DB2_Horizon" returned message "SQL0204: RMAGMASTA in BANK00 type *FILE not found. ..."

    I am spinning through a lot of tables and am only interested in the ones that have rows. Not a big deal, but i have a quick and dirty and I am using the PRINT statement to the Message window and would like NOT to have these OLE messages. Can they be supporessed?

  • I have never found a way to suppress them but I confess I haven't looked really hard.

    I'd be interested if someone does suggest a way.


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St

  • I can't easily reproduce this error, so couldn't test this.

    If you put the select in a try/catch block, is control passed to the catch block when the table is not found?

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Yes, the SELECT is in a Try Catch. And control does pass to the Catch. But I am using the EXEC sp_executesql or even if I put the SELECT directly in my procedure. The Link Server returns the message and it is put straight to the Message window.

    Is there a way to clear the message window?

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply