• Hugo Kornelis (5/15/2015)


    SQL-DBA-01 (5/15/2015)


    Seems like it's sort of ISNULL function. If it's encountered NULL, the 3rd parameter will replace the entered value. Nice Question.

    No, the default parameter of LAG and LEAD is only used when applying the specified offset results in a row outside of the range. If there is an actual row there, the value from that row will always be used, even when it is NULL.

    That's good to know. I think I have to put ISNULL in some of my scripts now 🙂

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP