Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase «««123

T-SQL Expand / Collapse
Posted Monday, November 17, 2008 8:20 AM



Group: General Forum Members
Last Login: Yesterday @ 12:16 PM
Points: 2,465, Visits: 2,909
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.


"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?'"
Post #603695
Posted Monday, November 17, 2008 10:31 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum 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


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 !
Post #604097
Posted Wednesday, January 16, 2013 2:16 AM



Group: General Forum Members
Last Login: Today @ 12:30 AM
Points: 1,984, Visits: 2,425
really nice question.....

To get quick answer follow this link:
Post #1407688
« Prev Topic | Next Topic »

Add to briefcase «««123

Permissions Expand / Collapse