0

Why do I still receiving in the emails: Warning: Null value is eliminated by an aggregate or other SET operation. If I have set the 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
4

1 回答 1

2

You have to put set ansi_warnings off inside @q:

set @q = 'set ansi_warnings off select LSRNbr, trh.ShipperId, ...`
于 2013-06-13T21:13:02.480 回答