Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

sp_executeSQL recompile

$
0
0

Hi,

is it possible that if you have inside procedure dynamic sql, for quick example:

CREATE PROCEDURE dbo.myProcedure
@ln varchar(15)
WITH RECOMPILE AS

DECLARE @ExecStr nvarchar(4000)
SELECT @ExecStr = 'SELECT...'

EXEC sp_executesql @ExecStr, N'@lastname varchar(15)', @ln 

and you call this procedure, dynamic sql still takes plan from the cache, even SP has forced recompile?
When this would happen?
Then I should explicitly include recompile hint into sp_executesql?

I couldn't find an example, but some people claim that it is possible.

br, Simon


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>