April 26, 2021 at 1:28 pm
Hi
Does anyone know of a good way to Drop and Recreate all Primary and Foreign Key Constraints for all tables in a database please?
Ive looked at various solutions but they dont seem to capture and recreate all the PK and FK constraints for all tables
April 26, 2021 at 1:34 pm
April 26, 2021 at 3:09 pm
Out of interest why do you want to do this? What are you trying to by dropping all your constraints and then simply recreating them?
Constraints need to be dropped in a specific order too when dealing with keys. You can't drop a primary key until all of the foreign keys referencing it are dropped too, so you need to ensure any script you do create does things in the right order as well.
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy