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?
 
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.
0
 
TempDBACommented:
Are you sure that you are running with the same parameters?
And add SET NoCount on to your procedure.
0
 
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.
0
 
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.
0
 
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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.