• Yeah, not bad, although it does have to do a full index scan for trans date on the TD table.

    You can do minor tweaks on the list itself, changing it to a keyed, unique temp table and TRUNCATEing it instead of DELETEing from it.

    CREATE TABLE #IDsToDelete (

    ID uniqueidentifier PRIMARY KEY

    )

    ...

    TRUNCATE TABLE #IDsToDelete

    ...

    When you can, you might want to cluster these tables on tran date time (assuming it (almost) never changes once the row is inserted). You can continue to use a nonclus index on ID, which has more freespace and is rebuilt much more often.

    SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.