Getting LEAD and LAG values manually

  • Comments posted to this topic are about the item Getting LEAD and LAG values manually

    Sheraz Mirza::hehe:

  • Really helpful especially if you are using SQL 2008 because there are no such functions in it.

  • brain.twizter (6/14/2016)


    Really helpful especially if you are using SQL 2008 because there are no such functions in it.

    I agree.

  • The performance of this "work-around" (for those who are stuck with earlier SQL Server) is inferior to the performance of the LEAD / LAG functions, which require reading the table only once instead of once for every record to find the match as for the work-around.

    So for those who do have the LEAD / LAG version, if you are still using the work-around method, it is time to learn about using the new functions.

  • The Lead/Lag functions were one of the main reasons we upgraded to SQL 2012. We had a process that went from running for 45 minutes daily to running in 4 minutes using LAG. 😀

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

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