且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

添加SQL Server索引,但如何只重新编译受影响的存储过程?

更新时间:2023-02-07 18:30:43

您可以优先考虑sp_recompile并提供刚刚编入索引的表名。所有依赖于该表的proc将从存储的proc缓存中刷新,并在下次执行时被编译

You can exceute sp_recompile and supply the table name you've just indexed. all procs that depend on that table will be flushed from the stored proc cache, and be "compiled" the next time they are executed

从msdn docs中查看:
sp_recompile(Transact-SQL)

See this from the msdn docs: sp_recompile (Transact-SQL)