crackyourinterview.com


To improves our performance please Like Share Subscribe(Will boost us)

How can we recompile a stored procedure at run time in SQL Server?
Question Posted on 06 Sep 2021Home >> DataBase >> sql questions >> How can we recompile a stored procedure at run time in SQL Server?

How can we recompile a stored procedure at run time in SQL Server?
Below are the different methods to recompile a store procedure at runtime in SQL Server:-

(1)Below we have put parameter value as 10 and use keyword as RECOMPILE
EXEC dbo.Proc_name @parameter1=10 WITH RECOMPILE;
GO


(2)By using sp_recompile system store procedure
EXEC sp_recompile 'Person.Address';
GO


(3)By using RECOMPILE hints keywords in stored procedure headers
ALTER PROCEDURE dbo.Proc_name
@parameter1 int
WITH RECOMPILE
AS
SELECT statements
EXEC dbo.Proc2 @parameter1;
GO


(4)By adding RECOMPILE with select statement in store procedure
ALTER PROCEDURE dbo.Proc_name
@parameter1 int
AS
SELECT statement where clause OPTION (RECOMPILE);
EXEC dbo.Proc2 @parameter1;
GO
0
0



.


Most Visited Questions:-

Deep Learning Questions Answers
Below are the different Deep Leaning Questions and answer a More...

Continuous Integration Questions Answers
Below are the 20 odd questions for CI or Continuous Integra More...

Derived relationships in Association Rule Mining are represented in the form of __________.
Derived relationships in Association Rule Mining are repres More...

What is Gulpjs and some multiple choice questions on Gulp
Gulpjs is an open source whihc helps in building Javascript More...

Microservices Architecture Questions Answers
Below are the different questions on Microservices Architec More...




Other Important Questions

Define N in nvarchar and in nchar?

difference between drop and truncate command

difference between procedure and function

different types of databases in sql

Difference Between Update Lock and Exclusive Lock






@2014-2022 Crackyourinterview (All rights reserved)
Privacy Policy - Disclaimer - Sitemap