Transact SQL scripts written by
DBAs and Developers for
DBAs and Developers.
To submit a comment about this script
here or to submit your own script
click here.
Drop and Recreate Foreign Keys
Description:
Identifying all the foreign key relationships that exist on a table can be easily accomplished using sys.foreign_keys. However, dropping the foreign keys and adding them back can be difficult if a script does not exist. This result of this script is a list of ALTER TABLE scripts that Drops all existing Foreign Keys on a table and Re-Creates those keys that were dropped. Replace the TABLENAME and SCHEMANAME with your values.
Submitted By:
2008DBA