TOP 5000000? That's an aweful lot of rows to be 'limiting' a result set to. What's the purpose of that TOP clause?
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