/ Published in: SQL

Delete All Foreign Keys in a database;
(make sure you USE keyword)
(make sure you USE keyword)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
SELECT 'ALTER TABLE ' + TABLE_SCHEMA + '.[' + TABLE_NAME + '] DROP CONSTRAINT [' + CONSTRAINT_NAME + ']' FROM information_schema.table_constraints WHERE CONSTRAINT_TYPE = 'FOREIGN KEY'
Comments
