Order of execution in SQL Server variable assignment using SELECT
问题 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