Iulian -207023 (11/18/2010)
One innocent remark that does not minimize the high value of the question. I am thinking to drop tbl1 and tb2 tables at the end of the script:
DROP TABLE tbl1
DROP TABLE tbl2
and to place a GO statement before CREATE PROCEDURE since 'CREATE/ALTER PROCEDURE' must be the first statement in a query batch.
Regards,
Iulian
This is exactly why I got this right -- I assumed that the procedure would not compile because it was not the first statement in a batch the way it was written.