Variable assignments

  • Nice question. Thanks Evgeny.

  • Really nice. I wish I thought of this question myself. Oh well, next time. Until then, see you online.

  • Jeff Moden - Monday, July 23, 2018 1:46 PM

    lmalatesta - Monday, July 23, 2018 10:20 AM

    Keep in mind that this trick relies on behavior that is not only undocumented but officially undefined. There is no guarantee that this trick will work with the next SQL Server update.

    Heh... While what you say is true, I'll take the bet that it'll work with the next SQL Server update... and the next several dozen after that. 😉

    While it took until SQL Server 2012 to remove the syntax for RAISERROR deprecated in SQL Server 2005, it still happened. That probably broke a lot more production code than changing this behavior would.

    I don't see a reason why Microsoft would change it. But I also wouldn't rely on it unless there was a really good reason such as a significant performance benefit.

  • lmalatesta - Thursday, August 2, 2018 11:03 AM

    Jeff Moden - Monday, July 23, 2018 1:46 PM

    lmalatesta - Monday, July 23, 2018 10:20 AM

    Keep in mind that this trick relies on behavior that is not only undocumented but officially undefined. There is no guarantee that this trick will work with the next SQL Server update.

    Heh... While what you say is true, I'll take the bet that it'll work with the next SQL Server update... and the next several dozen after that. 😉

    While it took until SQL Server 2012 to remove the syntax for RAISERROR deprecated in SQL Server 2005, it still happened. That probably broke a lot more production code than changing this behavior would.

    I don't see a reason why Microsoft would change it. But I also wouldn't rely on it unless there was a really good reason such as a significant performance benefit.

    Not sure what you're talking about.  RAISERROR still works just fine in 2016.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 4 posts - 16 through 18 (of 18 total)

You must be logged in to reply to this topic. Login to reply