December 30, 2008 at 2:20 am
im altering a table in SSMS to remove a foreign key constraing, and re-add it with update cascade enabled. for even a small table this is taking 2+ hours. why is this and is there a quicker way?
December 30, 2008 at 2:26 am
December 30, 2008 at 3:03 am
Are you using the SSMS GUI or executing query for removing the FK.
If using the GUI then, some time it drops and recreate the tables. So first see the script for changes before you save the table change.
If executing the T-SQL then your table might have so many records and idexes on it.
Regards,
Nitin
December 30, 2008 at 3:26 am
I think better is to do with T-SQL !
Simple:
First Drop Constraint then
Add Constraint again
ALTER TABLE Your_Table
DROP CONSTRAINT constraint_name;
ALTER TABLE Your_Table
ADD CONSTRAINT constraint_name FOREIGN KEY (your_field) REFERENCES Ref_Table_Name(Ref_field) ON DELETE OR UPDATE CASCADE
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply