I have a problem with a database running in SQL Server 6.5 (Service Pack 4). We moved the database (object transfer) from one machine to another last night, and an error (specific to a stored procedure) is cropping up. However, I can't tell which procedure is causing it. Permissions are granted in all of our stored procedures; is there a way from the isql utility to force all stored procedures to recompile?
Tips: sp_recompile can recomplie a store procedure each time
Answer:在执行存储过程时,使用 with recompile 选项强制编译新的计划;使用sp_recompile系统存储过程强制在下次运行时进行重新编译
USE AdventureWorks;
GO
EXEC sp_recompile N'Sales.Customer';
GO
GO
EXEC sp_recompile N'Sales.Customer';
GO
这样可以使与表'Sales.Customer'相关的存储过程在下次运行时重新编译。