I have a stored procedure that executes a t-sql statement using sp_executesql. This t-sql code recompiles everytime it runs using "INSERT INTO" but when I use "INSERT" only it will not recompile. What is going on here?
sample:
create table #test (id int)
Recompile:
insert into #test select id from mytable
Not Recompile:
insert #test select id from mytable
Software/Hardware used:
SQL Server 2008
ASKED:
March 23, 2011 7:34 PM
UPDATED:
March 24, 2011 11:42 PM
Are you doing this test with both insert statements within the same batch of code (a stored procedure for example) or two different batches of code?