SQL Kiwi (9/6/2012)
For each table name: if we already have such a table in the database, drop it ...
... and say goodbye to a concurrent process (if any) 🙂
Not so good, I would say.
An improvement might be to limit the target tables to temporary tables. That's the scenario I would expect this sort of idea to be used with. On the other hand, we also have MARS...but I guess that's another story.
Temporary tables could be a good improvement if we only need resulting tables in same session. It all depends on your requirements.
If we don't need to drop tables at all, we can just remove corresponding code from the procedure. In my case, corresponding tables didn't exist before procedure execution, and creating those tables by hands could be huge waste of time because I had lots of stored procedures to process.