Friday, February 24, 2012

A Question About Detecting ANSI_WARNINGS Warnings

Hi,

I have a question about ANSI_WARNINGS and how to detect them. If I execute the following query in Query Analyzer:

SET ANSI_WARNINGS ON
SELECT SUM(pubs..discounts.lowqty) FROM pubs..discounts

I see the warning, as expected:

----
100

(1 row(s) affected)

Warning: Null value is eliminated by an aggregate or other SET
operation.

Is there a place on the server (or, client) where this is logged? (The assumption should be that users won't be using Query Analyzer to execute SQL like this, so, of course, they wouldn't see the warning text.)

As for the OLE DB code, the HRESULT from executing this SQL is 0 (S_OK). Is there any programmatic way of detecting this warning so that I may log to a file, etc.?

TIAI hope u need to specify ANSI_Warnings OFF

:)

No comments:

Post a Comment