GilaMonster (8/16/2012)
SQLSACT (8/15/2012)
To make sure I have this right, if a Query is submitted to SQL Server and it's not part of a Stored Procedure, SQL Server has to generate a plan for it everytime?Thanks
No. Ad-hoc SQL statements have their plans cached and reused just like stored procedures Only difference is the matching is on statement text not object id.
Thanks
Regarding the 3 select statements below, would SQL use the same plan for the first 2 and a different plan for the 3rd one?
select Col1 from Table1 where Col1 = '10';
select Col1 from Table1 where Col1 = '10';
select Col1 from Table1 where Col1 = '12';