We have over 20 stored procedures and they all seem to work fine.
Every once in a while one of the stored procedures will glitch and
return the error, "Incorrect syntax near 'E'." One w it will be one
stored procedure. Another w it will be another. We try to 'solve'
the problem by dropping and recreating the procedure and it works fine
again. (Note that we did not change any syntax in the stored
procedure.) After we recreate the stored procedure it will work a few
times and then it will stop working. It's appears random and we cannot
isolate what is causing it. Simply running it a few times can cause
it.
One time we found out that playing around with the indexes of a column
caused the error (which is very strange.) We have no clue what is
going on.
So now I am attempting to debug it in Visual Studio by attaching a
process to the sqlservr.exe.
Does anyone out there have any idea what is going on? I truly believe
it is a SQL Server bug and not on our end because it is so random and
the syntax of the sp has nothing to do with the error.If this is reproducible, can you post one culprit stored procedure & the
structures of the tables involved?
Anith|||After ws of this issue we have found a solution. Here is the
problem and the solution:
Problem: I have two stored procedures. One (p1) does inserts, and
updates. The second one (p2) just selects. p1 is run before p2. If I
run p1 multiple times before p1 finishes, it will mess up p2 with the
error message (Incorrect syntax near 'E'). This is crazy because the
syntax for p2 never changes.
Solution: For p1 add "WITH RECOMPILE" to the stored procedure. It
forces p1 to compile everytime. Seems to work.
No comments:
Post a Comment