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
精彩评论