0

I usually create a duplicate table like this:

CREATE TABLE TEST_NEW AS SELECT * FROM TEST;

This does create a replica of the original table, however, the constraints aren't replicated.

is there a way to replicate the constraints as well?

I have also tried this:

CREATE TABLE TEST_NEW AS SELECT * FROM TEST WHERE 2=1

This also replicates the structure and only creates the Check constraint.

1
  • generally speaking, constraints must be recreated separately.
    – pmdba
    Commented Dec 29, 2023 at 0:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.