Given the following example:
declare @i int
select @i = 1, @i = 2
select @i
Will @i
always be 2?
This is about the most trivial example I can think of, but I am considering using this for swapping values in variables. I also believe this method of assignment (select) is not ANSI compliant (however useful), but don't really care to have portable code in this case.
UPDATE
Thanks to @MichaelFredrickson, we have @MartinSmith's answer and reference to MSDN on this. I am now struggling with what the second sentence in this documentation means, exactly (emphasis added):
If there are multiple assignment clauses in a single SELECT statement, SQL Server does not guarantee the order of evaluation of the expressions. Note that effects are only visible if there are references among the assignments.
The first sentence is plenty enough to keep me away from relying upon the behavior, however.