Hi @ASHMITP ,
Welcome to Microsoft Q&A!
Please also provide the details of [VIEW] which may cause this warning. There could be one aggregation on one column which has null values in your [VIEW].
We could disable this warning by setting ansi_warnings off but this may cause other effects or cause failures when your queries use features like indexed views, computed columns or XML methods.
In some cases you could rewrite the aggregate to avoid it.
For example, COUNT(nullable_column) could be rewritten as SUM(CASE WHEN nullable_column IS NULL THEN 0 ELSE 1 END) or SUM(IIF(nullable_column IS NULL,0 ,1) but this isn't always possible to do straightforwardly without changing the semantics.
You could refer below example:
select count(id) from (
select 1 id
union
select NULL) a
Warning: Null value is eliminated by an aggregate or other SET operation.
We could rewrite it as below:
select sum(IIF(id is null,0,1)) from (
select 1 id
union
select NULL) a
Output:
1
Best regards,
Melissa
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.