Turn off ANSI_WARNINGS for heterogenous queries We have a Stored Procedure with many linked-server queries. When executing it displays a Warning:


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


To suppress this, I  tried :


  SET ANSI_WARNINGS OFF


But that threw this error :


  Heterogeneous queries require the ANSI_NULLS and ANSI_WARNINGS options
  to be set for the connection. This ensures consistent query semantics.
  Enable these options and then reissue your query.


All articles I looked at mention setting ANSI_WARNINGS to ON to get it to work.
But I Absolutely do not want to see those Warnings, because I'm sending query results as attachment in sp_send_dbmail which has that Warning message right at the top of attachment.

Is it possible to suppress the warnings for heterogenous queries ?
This should remove your warning.

select name, count(employeeId) from employees group by name
select * from RemoteServer..departments