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 2000 Forums
 SQL Server Administration (2000)
 Stored procedure Recompiles

Author  Topic 

scottpt
Posting Yak Master

186 Posts

Posted - 2004-07-02 : 22:06:08
Win 2000 SQL 2000 sp3a w/ hotfix

I have a app that uses a stored proc with a temp table. THe temp table causes a recompile every time the proc is run. I cannot remember wht the command it to use the plan cache. Something like Create procedure keep plan or somthing???

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-07-02 : 22:24:30
SET FORCEPLAN ON

Can you replace the temp table with a table variable though? How many rows are we talking here?

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2004-07-03 : 15:12:10
Do you create the temp table in the app then call the SP. If so there's nothing you can do about it.
You can move all the temp table access into dynamic sql or another SP to make the recompiles quicker if you wish.
Or make it a permanent table accessed via the spid.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -