Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Query seems to always recompile

Author  Topic 

denis_the_thief
Aged Yak Warrior

596 Posts

Posted - 2011-01-06 : 16:38:33
I declare #Table1 in StoredProc1. StoredProc1 calls StoredProc2. In StoredProc2, I have a statement like insert into #Table1 select ... . This insert/select seems to be recompiling everytime the StoredProc1 is called. Is that because it inserts into a temp table that is declared in a different Stored Procedure? Or any other insight or ideas? Just that with the recompile, its adding an unnecessary 3 extra seconds.

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-01-06 : 16:53:04
Any DDL in your SP is likely to cause a recompile. However, recompiles typically take milliseconds, not seconds, so you have something else going on I think.

Might add a WITH RECOMPILE to the SP.
Go to Top of Page
   

- Advertisement -