• Sean Lange (2/5/2016)


    DonlSimpson (2/5/2016)


    I don't like this part of the answer: "across all rows in a table" because the result can be confined by a where clause.

    And you can also use grouping to segregate the values. The BOL entry states "group" which is more accurate.

    And the FROM clause may specify a view instead of a table, or some complicated mix of inner joins and outer joins and cross joins using views as well as tables. This of course suggests that the word "table" in the question is absolutely correct because it is clearly being used in its general sense which includes "derived table" (a derived table is any rowset which can be derived from the base tables of the schema using SQL).

    However, I liked the question. Not something I have ever used and will probably forget the next time I could make use of it. 😀

    I quite like the question too. I thought about using it (checksum_agg, not the question :hehe:) once, then thought a bit harder about what the order-independant "checksum" might be, ran some trivial experiments, and decided this aggregate was much too likely to return false negatives to be any use at all for what I was trying to do (and, I believe, discovered exactly what the aggregate was: the reduction of XOR over the list of values). So I also believe, of course, that BoL is wrong about the properties of this aggregate - changing one of the values fed into the aggregation will, I believe, always change the resulting aggregate - to avoid changing the aggregate you have to change at least two of the input values, and BoL has said ever since I remember said that changing one of the input values may (rarely) not change the result.

    Tom