g_johnson
asked on
MS SQL 2000: Warning: Null value is eliminated by an aggregate or other SET operation.
The attched code works fine, sometimes returning data and sometimes returning an empty rowset.
I also have a table:
CREATE TABLE [esna_PdInvoices] (
[cus_no] [char] (20) COLLATE SQL_Latin1_General_CP1_CI_ AS NOT NULL ,
[inv_no] [char] (8) COLLATE SQL_Latin1_General_CP1_CI_ AS NOT NULL ,
[Id] [numeric](9, 0) IDENTITY (1, 1) NOT NULL
) ON [PRIMARY]
GO
If I add this insert statement where indciated, I get the "Warning: Null value is eliminated by an aggregate or other SET operation" error:
insert into esna_PdInvoices (cus_no,inv_no)
However -- the insert works. I need to eliminate the error, or at least the message ...
I also have a table:
CREATE TABLE [esna_PdInvoices] (
[cus_no] [char] (20) COLLATE SQL_Latin1_General_CP1_CI_
[inv_no] [char] (8) COLLATE SQL_Latin1_General_CP1_CI_
[Id] [numeric](9, 0) IDENTITY (1, 1) NOT NULL
) ON [PRIMARY]
GO
If I add this insert statement where indciated, I get the "Warning: Null value is eliminated by an aggregate or other SET operation" error:
insert into esna_PdInvoices (cus_no,inv_no)
However -- the insert works. I need to eliminate the error, or at least the message ...
declare @begdate datetime
declare @enddate datetime
set @begdate = '20080601'
set @enddate = '20080630'
--<<<<<< add insert statement here >>>>>>--
SELECT c.debcode,t4.invoicenumber
FROM (
SELECT t1.transactionnumber, isnull(MIN(t2.matchid),0) AS matchid1, isnull(MAX(t2.matchid),0) AS matchid2
FROM banktransactions t1
INNER JOIN banktransactions t2 ON t2.transactionnumber = t1.transactionnumber AND
t2.type = 'W' AND t2.transactiontype = 'C' AND t2.status <> 'v'
WHERE t1.type = 'S' AND t1.transactiontype = 'Z' AND t1.status <> 'V'
GROUP BY t1.transactionnumber
HAVING COUNT(*) = 2
) AS sz_to_2wc
INNER JOIN banktransactions t3 ON t3.id IN (sz_to_2wc.matchid1, sz_to_2wc.matchid2) AND
t3.type = 'S' AND t3.transactiontype = 'Y' AND t3.status <> 'V'
INNER JOIN banktransactions t4 ON t4.matchid = t3.id AND
t4.type = 'W' AND t4.transactiontype = 'K' AND t4.status <> 'V'
join cicmpy c on t4.debtornumber = c.debnr
where t4.valuedate between @begdate and @enddate
and t4.debtornumber is not null
ASKER
Can you suppress the warning being returned from the s/p so that the user doesn't see it?
ASKER
Oh yeah -- and what does it mean? The select alone does not issue the warning. It only happens when you add in the insert statement
You can try including this before the statement...I can't remember if it is an ansi warning though
SET ANSI_WARNINGS OFF
SET ANSI_WARNINGS OFF
ASKER
That worked to suppress it, but, again, can you tell me what is causing the issue?
ASKER
I think I understand what the warning means, I just don't understand why it only occurs on the insert and not on the select when run stand-alone.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thanks
This isn't an error, it is a warning...