Meaning of 'SET' in error message 'Null value is eliminated by an aggregate or other SET operation' I saw the above 'ANSI warning' message today when running a colleague's script (and I don't know which of the many statements caused the warning to be shown).

In the past I've ignored it: I avoid nulls myself and so anything that would eliminate them is a good thing in my book! However, today the word 'SET' literally shouted out at me and I realised I don't know what the meaning of the word is supposed to be in this context.

My first thought, based on the fact it is upper case, is that it is referring to the SET keyword and means 'assignment', as in 

UPDATE &lt;table&gt; SET ...

...ON DELETE SET NULL...

SET IDENTITY_INSERT &lt;table&gt; ON


According to the SQL Server Help, the 'ANSI warnings' feature is based on ISO/ANSI SQL-92, the spec for which makes just one use of the term 'Set operation' in a subsection title, hence in title case, in the data assignment section. However, after a quick Googling of the error message I see examples that are SELECT queries with seemingly no assignment involved.

My second thought, based on the wording of the SQL Server warning, was that the mathematical meaning of set is implied. However, I don't think that aggregation in SQL is strictly speaking a set operation. Even if the SQL Server team consider it to be a set operation, what is the purpose of putting the word 'set' in capitals?

While Googling I noticed a SQL Server error message: 

Table 'T' does not have the identity property. Cannot perform SET operation.


The same words 'SET operation' in the same case here can only refer to the assignment of the IDENTITY_INSERT property, which brings me back to my first thought.

Can anyone shed any light on the matter?
I was just looking through the SQL-92 Specification and saw a passage that reminded me of this question.

There is in fact a prescribed warning for this situation as indicated below


  b) Otherwise, let TX be the single-column table that is the
                result of applying the &lt;value expression&gt; to each row of T
                and eliminating null values. If one or more null values are
                eliminated, then a completion condition is raised: warning-
                null value eliminated in set function.


I assume that the SET in the SQL Server Error Message is a reference to the set function of that error message although I'm not sure why it would make a distinction between aggregates and other set functions, as far as I can see they are synonymous. The relevant bit of the grammar is below.

6.5  &lt;set function specification&gt;

         Function

         Specify a value derived by the application of a function to an
         argument.

         Format

         &lt;set function specification&gt; ::=
                COUNT &lt;left paren&gt; &lt;asterisk&gt; &lt;right paren&gt;
              | &lt;general set function&gt;

         &lt;general set function&gt; ::=
                &lt;set function type&gt;
                    &lt;left paren&gt; [ &lt;set quantifier&gt; ] &lt;value expression&gt; &lt;right paren&gt;


         &lt;set function type&gt; ::=
              AVG | MAX | MIN | SUM | COUNT

         &lt;set quantifier&gt; ::= DISTINCT | ALL