April 11, 2014 at 1:33 am
Hi while executing the profiler data getting the below error.
declare @P1 int set @P1=3768 exec sp_prepare @P1 output, NULL, N'SELECT * FROM MYTABLE', 1 select @P1
go
Msg 8179, Level 16, State 2, Procedure sp_prepare, Line 1
Could not find prepared statement with handle 3768.
April 11, 2014 at 4:28 am
I'm not an expert on sp_prepare, but I'm pretty sure you're not supposed to set the value to a particular number, you're supposed to capture that value in the output and then use it later. Try the same thing without the value.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
April 11, 2014 at 5:15 am
Grant Fritchey (4/11/2014)
I'm not an expert on sp_prepare, but I'm pretty sure you're not supposed to set the value to a particular number, you're supposed to capture that value in the output and then use it later. Try the same thing without the value.
I think Grant is right. The handle is an output parameter of sp_prepare. LMGTFY: See http://technet.microsoft.com/en-us/library/ff848808%28v=sql.105%29.aspx
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply