为什么我仍然收到电子邮件:Warning: Null value is eliminated by an aggregate or other SET operation.
如果我设置了ansi_warnings off
set ansi_warnings off
set @subj = 'xxx'
set @msg = 'xxx' + char(13) + char(10)
set @q = 'select LSRNbr, trh.ShipperId, InvoiceNbr, Qty, count(LotSerNbr) as QtyRcvd
from tblRIM2_Header trh (nolock)
left outer join tblRIM2_SerialsFromFile trs (nolock) on trh.ShipperId = trs.ShipperId
where isnull(Completed,0) = 0
group by trh.ShipperId, LSRNbr, InvoiceNbr, Qty'
exec master.dbo.xp_sendmail
@recipients = 'xxx',
@subject = @subj ,
@query = @q,
@message = @msg,
@attach_results = FALSE,
@dbuse = 'GlobalQCS'
set ansi_warnings on
答案 0 :(得分:2)
您必须将set ansi_warnings off
放入@q
:
set @q = 'set ansi_warnings off select LSRNbr, trh.ShipperId, ...`