Question [SQL]: the fastest way to recompile all stored procedures

Source: Internet
Author: User
Question: The fastest way to recompile all stored procedures

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 R Ecompile?

TIPS: sp_recompile can recomplie a store procedure each time

 

Answer: When executing a stored procedure, use the with recompile option to force the compilation of a new plan; Use sp_recompile to force the re-compilation at the next run.

Use Adventureworks;
Go
Exec Sp_recompile n ' Sales. Customer ' ;
Go

In this way, the stored procedure associated with the table 'sales. custom' can be re-compiled at the next run.

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.