Faking Create Or Replace Table
January 20, 2015 Ted Holt
The new CREATE OR REPLACE feature of SQL has been most helpful to me. It works for aliases, functions, masks, permissions, procedures, sequences, triggers, variables and views. It would be nice if it worked for tables, especially when I’m developing a new application. Here’s a workaround. The trick is to use a dynamic compound statement. If you’re not familiar with these, I recommend you read Michael Sansoterra’s excellent article on that subject. One of the things that dynamic compound statements let you do is include conditional logic, which is what we need. We need a way to drop a table |