Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

How to suppress SELECT returned messages Expand / Collapse
Author
Message
Posted Tuesday, August 13, 2013 6:55 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Today @ 10:53 AM
Points: 15, Visits: 123
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?
Post #1484045
Posted Tuesday, August 13, 2013 7:24 PM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 7:59 PM
Points: 3,631, Visits: 5,280
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!

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?
Since random numbers are too important to be left to chance, let's generate some!
Learn to understand recursive CTEs by example.
Splitting strings based on patterns can be fast!
Post #1484052
Posted Tuesday, August 13, 2013 11:39 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 11:23 AM
Points: 5,047, Visits: 11,799
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?



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #1484072
Posted Wednesday, August 14, 2013 6:58 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Today @ 10:53 AM
Points: 15, Visits: 123
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?

Post #1484255
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse