Lucky9 (6/12/2013)
I have a stored procedure to do the performance tuning, so below are the list of questions could someone please reply...
so with the above problem what is the best way to rewrite the sql query
Can you post the Actual Execution Plans for the stored procedure? That's the quickest way for folks here to determine why your queries are slow.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden