July 19, 2003 at 12:32 pm
i am trying to find out where the table properties on relationships like
Enforce relationship or replication,
cascade update related fields etc
are stored? I need to change these settings globally for all the tables in my tables and changing it manually one by one for all my tables is going to be impossible.
July 21, 2003 at 12:30 pm
These aren't properties of the table, but of the constraint in question that applies to column(s) in the table. Instead of rooting through the system tables trying to set and unset values (very dangerous), it is safer to loop through the tables in a dynamic SQL script using:
ALTER TABLE < Table Name >
DROP CONSTRAINT < Constraint Name >
GO
--
ALTER TABLE < Table Name > WITH NOCHECK
ADD CONSTRAINT < Constraint Name >
FOREIGN KEY ( < Columns > )
REFERENCES < Table Name > ( < Columns > )
ON DELETE CASCADE
ON UPDATE CASCASE
NOT FOR REPLICATION
May 30, 2005 at 2:45 am
Problem with this approach is how to define the columns that were actually in the 'dropped' FK, right?
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply