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.
"I love spending twice as long and working twice as hard to get half as much done!" – Nobody ever.
"Operator! Give me the number for 911!" - Homer Simpson
"A SQL query walks into a bar and sees two tables. He walks up to them and says 'Can I join you?'"