SSRS: Warning: Null value is eliminated by an aggregate or other SET operation

We have a SSRS Report that uses a SQL 2008 R2 stored procedure as its main dataset.  When we run the stored procedure from SSMS it runs without error.  When we run it from an SSRS report we get the error:

"An error has occurred during report processing. (rsProcessingAborted)
Query execution failed for dataset 'RoyaltiesACH'. (rsErrorExecutingCommand)
Arithmetic overflow error converting varchar to data type numeric. Warning: Null value is eliminated by an aggregate or other SET operation. Warning: Null value is eliminated by an aggregate or other SET operation. Warning: Null value is eliminated by an aggregate or other SET operation. Warning: Null value is eliminated by an aggregate or other SET operation. Warning: Null value is eliminated by an aggregate or other SET operation. Warning: Null value is eliminated by an aggregate or other SET operation. Warning: Null value is eliminated by an aggregate or other SET operation. Warning: Null value is eliminated by an aggregate or other SET operation. Warning: Null value is eliminated by an aggregate or other SET operation. Warning: Null value is eliminated by an aggregate or other SET operation."

It gives the same error if ran from Visual Studio in the Report Designer.  This report is rather old and just started producing this error.  Again when we run the SPROC by itself no problems, but when a report uses it it errors out.
BeratungAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TempDBACommented:
Are you sure that you are running with the same parameters?
And add SET NoCount on to your procedure.
Anthony PerkinsCommented:
This report is rather old and just started producing this error.  Again when we run the SPROC by itself no problems, but when a report uses it it errors out.
In SSMS, this is a warning message not an error.  If you do not want to have the warning message you have two choices:
1. Fix the data, by removing the NULLs that are causing it.
2. Fix the query by conditioning the columns that are causing it.

Pick your poison.
BeratungAuthor Commented:
This warning does not appear in SSMS.  It only appears in SSRS.  This seems to be a bug.  Somehow the execution plan or something is affected when you run this stored procedure within an SSRS report.  The reason this was hard to find the cause is because there is a filter in a where clause that filters out the row causing the problem.  When you run it in SSMS it seems the row that causes the error is not included when teh CAST and/or CONVERT is applied.  When you run it from SSRS the CAST/CONVERT is applied then the records are filtered.  In this case, we were CASTING a number into a VARCHAR (9).  All records in the data set were 9 digits.  There was a record that was filtered out that was 10 digits.  It was that one record that caused a problem when using SSRS but NOT when using SSMS to rund the SPROC.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Anthony PerkinsCommented:
This warning does not appear in SSMS.  It only appears in SSRS.
Sure it does.  You are just not looking in the right place.  You are using the Grid mode and and not checking the Message tab.  Run it as Text and you will see it.

This seems to be a bug.
Nope.

When you run it in SSMS it seems the row that causes the error is not included when teh CAST and/or CONVERT is applied.
Correct that is why it is a Warning and not an Error.
BeratungAuthor Commented:
This is a bug of some sort.  I other SQL Developers look at this code and the data and they agree it is behaving differently depending on how the stored procedure is run.  Running it in SSMS and SSRS, it behaves differently.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.