CREATE TABLE newTable as (SELECT * FROM oldTable WHERE 1=2)
Posted on 2001-06-30
I have number of tables and I want to make same tables again with different names without keeping the data, ie, copy their structures only. I am using "CREATE TABLE newTable as (SELECT * FROM oldTable WHERE 1=2)". Everyting is fine but the newTable created keeps at least the NOT NULL constraints while throwing out all other type of constraints. My questions are :
Q1. How to modify the above statement so that even NOT NULL constraints are thrown out.
Q2. Just opposite of what I asked above. How to modify the above statement so that ALL (yes all) constraints are intact in the newTable.