• Oleg Netchaev (10/29/2010)


    Oh well, I lost a precious point on this one. The statement in question

    select @a =+ @b-2

    looked so ridiculous that it made me think that there were 2 possibilities:

    - either it was the author's intention to actually write it as is, perhaps to show how difficult it can be to debug the errors based on misplacing the order of typed characters

    - it was a simple typo, and the += was intended

    Unfortunately, I chose the second option and thus answered the question incorrectly. I don't consider it a bad question, but cannot say that I learned something from it either, because in reality, nobody can actually benefit from ever typing something like

    select @a =+ @b-2

    when select @a = @b-2 does the trick.

    Oleg

    No, but you can benefit from knowing that it's an easy to make mistake, and that SQL Server won't alert you to the problem.


    Just because you're right doesn't mean everybody else is wrong.