开发者

When recompiling a stored procedure are dependency stored procedures also recompiled?

开发者 https://www.devze.com 2022-12-23 21:32 出处:网络
I have a stored procedure that basically calls 7 or 8 other stored procedures. I\'d like know if开发者_StackOverflow中文版 recompiling the outer stored procedure will cause the 7 or 8 to also be recom

I have a stored procedure that basically calls 7 or 8 other stored procedures. I'd like know if开发者_StackOverflow中文版 recompiling the outer stored procedure will cause the 7 or 8 to also be recompiled?


No.

Optimizing SQL Server Stored Procedures to Avoid Recompiles

Stored procedures will normally recompile before execution for a number of reasons, including: dropping and recreating the stored procedure, using the WITH RECOMPILE clause in the CREATE PROCEDURE or the EXECUTE statement, changing the schema of any referenced objects, running the sp_recompile system stored procedure against a table referenced by the stored procedure, restoring the database containing the stored procedure or any object referenced by the stored procedure, or the stored procedures plan dropping from the cache.

About the only automatic way a stored procedure will be recompiled is by adding the WITH RECOMPILE

here are other ways to recompile a stored procedure

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号