I get the warning "Null value is eliminated by an aggregate or other SET operation." and I cannot find the source of the problem. The code is below, what I basically want to do is to insert values in a table, based on the execution of 33 stored procedures (the coding for the execution is the same, so I give just a few examples below). I have looked for errors in the invoked SP, but found none since they all return the expected results based on test files.
Any suggestions for a solution?
CODE:
ALTER PROCEDURE [dbo].[SKL_SaveAdminKontroll_result]
AS
BEGIN
SET NOCOUNT ON;
declare @SQL VarChar(max)
set @SQL = '
DELETE FROM [dbo].[SKL_AdminKontroll_result]
DECLARE @kommuner VARCHAR(300)
DECLARE @landsting VARCHAR(300)
DECLARE @tableName VARCHAR(100)
SET @kommuner=''select id from [StatistikinlamningAdminSKL].[dbo].[Enhet] WHERE [EnhetsTyp] = 1''
SET @landsting=''select id from [StatistikinlamningAdminSKL].[dbo].[Enhet] WHERE [EnhetsTyp] = 2''
SET @tableName=''GR_PS09_1''
INSERT INTO [dbo].[SKL_AdminKontroll_result] ([Värde],[Typ],Enhetsid,Adminkontroll,[Datum för hämtat värde])
EXEC dbo.SKL_admin_KN_aform @tableName, @kommuner
INSERT INTO [dbo].[SKL_AdminKontroll_result] ([Värde],[Typ],Enhetsid,Adminkontroll,[Datum för hämtat värde])
EXEC dbo.SKL_admin_KN_annan_AID @tableName, @kommuner
INSERT INTO [dbo].[SKL_AdminKontroll_result] ([Värde],[Typ],Enhetsid,Adminkontroll,[Datum för hämtat värde])
EXEC dbo.SKL_admin_KN_ansvar @tableName, @kommuner
INSERT INTO [dbo].[SKL_AdminKontroll_result] ([Värde],[Typ],Enhetsid,Adminkontroll,[Datum för hämtat värde])
EXEC dbo.SKL_admin_LT_aform @tableName, @landsting
INSERT INTO [dbo].[SKL_AdminKontroll_result] ([Värde],[Typ],Enhetsid,Adminkontroll,[Datum för hämtat värde])
EXEC dbo.SKL_admin_LT_annan_AID @tableName, @landsting
INSERT INTO [dbo].[SKL_AdminKontroll_result] ([Värde],[Typ],Enhetsid,Adminkontroll,[Datum för hämtat värde])
EXEC dbo.SKL_admin_LT_ansvar @tableName, @landsting
'
EXEC (@SQL)
END
Best regards,
Hannes
It's just a warning, one of your stored procs is performing aggregation, and it's letting you know that NULL
values aren't captured in aggregates.
You'll have to investigate your stored procs to find out where the aggregation is taking place, but if you're getting the results you expect then there is no problem.
You can suppress the warning if you want:
SET ANSI_WARNINGS OFF
GO
Probably a bad practice to be suppressing warnings.