SQL Reuse of plans with sp_executesql
Reuse of plans with sp_executesql
USE Northwind
GO
DBCC FREEPROCCACHE
GO
EXEC sp_executesql N'SELECT firstname, lastname, title FROM employees
WHERE employeeID = @p', N'@p tinyint', 6
EXEC sp_executesql N'SELECT firstname, lastname, title FROM employees
WHERE employeeID = @p', N'@p tinyint', 2
EXEC sp_executesql N'SELECT firstname, lastname, title FROM employees
WHERE employeeID = @p', N'@p tinyint', 6
GO
SELECT * FROM master..syscacheobjects
WHERE dbid = 6