December 8, 2014 at 11:51 pm
Hello.
I am new in sql. I recently encountered runtime error while writing stp.
In my stp, i insert data from physical table into temporary table. do some process in temp table and then from this temp table i insert data into another physical table based on a certain group.
Now the issue is just after inserting data into temp table i had written RETURN and then compiled. On executing the stp i found error of column missing in group by clause which by mistake i had missed it.
What i would like to know is that inspite of making the stp return just after inserting into temp table, i encountered this error. Why???
Thnx
P
December 9, 2014 at 5:46 am
Because SQL Server doesn't compile a procedure on a line-by-line basis. It compiles the entire procedure, all at once. So, if you have syntax errors, you'll get an error, regardless of whether or not your code would have actually hit that error when it ran.
"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
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply