VickyDBA (10/10/2013)
I am wondering that I shouldnt be missing anything while doing this and that is what my question is.Here is my update block looks like. It is very long but i have just simplified it. I did breaking of code and run them in pieces and observed things like indexes execution plans.
Two things ..
First that your posted query will not work i guess because of Update #Temp
Second, you need to have indexes satisfing your query like indx on ID column of #temp table PLUS ID columns of other tables too .. and i think i will improve performance .
If possible , post the exec plan too in .sqlplan extension.
-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)