dbTalk Databases Forums  

Turning off foreign key contraints

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Turning off foreign key contraints in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Charlie@CBFC
 
Posts: n/a

Default Turning off foreign key contraints - 10-04-2005 , 09:02 PM






Hi:

I trying to import data using DTS. The foreign key contraints are firing
because data is being inserted into child tables before parent. When
importing data, is there a way to turn the foreign key contraints off?
This is big database, so it's not practical turn each off individually.

Thanks,
Charlie



Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Turning off foreign key contraints - 10-05-2005 , 12:56 AM






What about

ALTER TABLE tablename
NOCHECK CONSTRAINT ALL


You can then re-enable a disabled constraint with


ALTER TABLE tablename
CHECK CONSTRAINT constraintname

Allan

"Charlie@CBFC" <charle1 (AT) comcast (DOT) net> wrote


Quote:
Hi:

I trying to import data using DTS. The foreign key contraints are
firing
because data is being inserted into child tables before parent. When
importing data, is there a way to turn the foreign key contraints off?
This is big database, so it's not practical turn each off individually.

Thanks,
Charlie


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.