Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Why does a NULL aggregate warning in an SQL query causes the SSIS package to fail? Expand / Collapse
Posted Friday, November 2, 2012 9:09 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, November 9, 2012 8:23 AM
Points: 1, Visits: 21

An SSIS Package was failing with an error message as below:

Code: 0xC0202009 Source: DFT Populate ImageSummary OLE_SRC ProductImage [1] Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x00040EDA Description: "Warning: Null value is eliminated by an aggregate or other SET operation.".

On investigation, we have found that the message Warning: Null value is eliminated by an aggregate or other SET operation. is being returned by a SQL server (2005) query which the SSIS package runs as the source in DFT to insert into a destination table.

Select ProductID ,ImageTypeID ,DistinctImageCount ,ImageSize
(select a.ProductID ,a.ImageTypeID ,a.DistinctImageCount ,a.ImageSize ,RANK() OVER (PARTITION BY a.ProductID, a.ImageTypeID ORDER BY a.ImageSize) As Ranker
(SELECT TOP 100 Percent spi.ProductID ,sit.ImageTypeID ,CAST(COUNT(DISTINCT spi2.ImageTypeID) as bit) DistinctImageCount ,CAST(spi2.Size as varchar(50)) as ImageSize
FROM Stage.ProductImage spi CROSS JOIN Reference.ImageType sit LEFT JOIN Stage.ProductImage spi2 ON spi.ProductID = spi2.ProductID AND sit.ImageTypeID = spi2.ImageTypeID
GROUP BY spi.ProductID, sit.ImageTypeID,spi2.Size
ORDER BY spi.ProductID, sit.ImageTypeID,spi2.Size
where ranker = 1
Order by ProductID,ImageTypeID

We have resolved the issue by eliminating the warning message from SQL server by modifying the query:

CAST(COUNT(DISTINCT spi2.ImageTypeID)as bit) DistinctImageCount

CAST(SUM(DISTINCT ISNULL(spi2.ImageTypeID,0)) as bit) DistinctImageCount.

However we have few questions as below which we couldn't find an explanation and hoping to get an answer on this forum:

Why does a warning from SQL bubbles up to the SSIS package and causes the SSIS package to fail?

If we run the same package in all other dev and UAT environments with the same data set, it works fine. We can see the warning showing up in the SQL Server Management Studio, however does not cause the SSIS to fail. However the SSIS package in our Production environment fails. We are failing to understand the logic? Is there any threshold of warnings?

Post #1380432
Posted Monday, November 5, 2012 4:50 AM



Group: General Forum Members
Last Login: Yesterday @ 5:35 AM
Points: 5,024, Visits: 6,733
A warning is SQL will not cause the SSIS package to fail.
I propose you create an output file for the step of the job running the SSIS package.
Once the step has run (and failed), check this output file. you may find the actual error further down the in the file.
it could be that you are using a value in e.g. a derived column, which could fail upon receiving a NULL value for validation et al

Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
Post #1380986
Posted Tuesday, November 6, 2012 9:56 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Tuesday, September 10, 2013 7:12 AM
Points: 273, Visits: 83
i have similar issue, a store procedure was called from ETL Packages.
when executed store procedure alone warning was shown on result window but executing from pacakges was failed due to this warning.
To resolve we have add Set ANSI_WARNINGS OFF
That is actually the default on SQL 2008 and 2012
Post #1381787
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse