A Reuseable Window

  • Comments posted to this topic are about the item A Reuseable Window

  • Heh... I was having too much fun with this post and thought that someone might take it too negatively, and so I deleted it.

    --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)

  • Sorry, but the answer is wrong! I ran the code in SQL 2022 got below error:

    Msg 102, Level 15, State 1, Line 15

    Incorrect syntax near 'WINDOW'.

    Thanks & Best Regards,
    Hany Helmy
    SQL Server Database Consultant

  • Hany Helmy wrote:

    Sorry, but the answer is wrong! I ran the code in SQL 2022 got below error:

    Msg 102, Level 15, State 1, Line 15 Incorrect syntax near 'WINDOW'.

    You're probably not using the 2022 version of Adventureworks.  Like Steve said in the question as a condition. "When I run this on a SQL Server 2022 database, what happens?".

    Make sure that the Adventureworks database is set to the comparability level (16) for SQL Server 2022.

    --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)

  • Jeff Moden wrote:

    Heh... I was having too much fun with this post and thought that someone might take it too negatively, and so I deleted it.

    Bonus points for style.

  • You can use an older ADW db, as I show here:

    2023-10-02 10_12_49-SQLQuery1.sql - ARISTOTLE_SQL2022.AdventureWorks2017 (ARISTOTLE_Steve (72))_ - M

     

    However, needs to be in 2022 compat mode

    2023-10-02 10_13_00-Database Properties - AdventureWorks2017

Viewing 6 posts - 1 through 5 (of 5 total)

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