|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Today @ 1:47 PM
Points: 2,118,
Visits: 2,213
|
|
I got this right for the wrong reason. I didn't know that the lack of the GO was what added the second insert to the stored procedure. But the test insert just looked like part of the whole procedure after the procedure code (perhaps the lack of even a line break before the test insert tipped off my unconscious :)), so I figured the test insert will run every time the procedure runs.
Tricky question but a good lesson. I will definitely be more careful about creating procedures in the future.
Thanks! webrunner
------------------- "The chemistry must be respected." - Walter White
"A SQL query walks into a bar and sees two tables. He walks up to them and says 'Can I join you?'" Ref.: http://tkyte.blogspot.com/2009/02/sql-joke.html
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Monday, June 28, 2010 7:57 PM
Points: 4,
Visits: 8
|
|
slange (11/14/2008)
I fell victim to a similair script at one point.  As a result I now make it my standard habit that after the declaration of the sp i wrap the entire body in a begin end. declare myProc() as begin end Once you stub in the solid open and closing it is very easy to fill in the body and even more difficult to accidentally leave something inside the proc. YES, a good habit !
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Sunday, May 19, 2013 11:16 PM
Points: 1,061,
Visits: 1,151
|
|
| really nice question.....
|
|
|
|