venoym (1/28/2015)
An index on the ID (even unclustered) wouldsolve thespeed up the orderingproblemwith the TOP (1),butyoucould alsowould have add an "ORDER BY sdlh1.ID DESC" to it tomakeensure it always works properly...
Fixed that for you 😉 😀
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability