• tolga.kurkcuoglu (9/13/2012)


    from the name of the table, I guess there is a considerable amount of records in it.

    It looks like it, unneccessarily, computes the dateadd function for each row.

    you might store the value in a variable

    declare @yesterday smalldatetime = dateadd("d", -1, getdate())

    and use it like

    ...

    and date > @yesterday

    I doubt that that will make any difference. I'd be very surprised if the engine calls the dateadd function more than once. In the optimization phase it will do what you suggest. It just won't tell you about it.