• Always a fun trick to show off that you know bitwise operations... but it is slower than just using a third variable for the swap. This has been true in C and C++ for years upon years, and I just tested it in SQL Server 2000 and it is true there as well.

    Also, it fails miserably if you try to swap a variable with itself (although that is even less likely to come up in a stored procedure).

    -- Stephen Cook