Suresh B. (8/29/2012)
Is "ORDER BY C.FDDOC#, C.FDLINE" required?What is the type of C.FDLINE?
Creating an index on C.FDDOC#, C.FDLINE should imporve the tempdb size and execution time.
Yes, order is must because concatenation is based on this order columns.
I have created a staging table and filtered the records as GSquared said.
Now, the performance is so good. but it still affects the temp db. But anyway i am happy:-) with the results since temp db is affected only about 700 MB where it was affected around 11 GB earlier.
Thanks,
Charmer