dbTalk Databases Forums  

Disabling Relationships

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


Discuss Disabling Relationships in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Roy Goldhammer
 
Posts: n/a

Default Disabling Relationships - 09-08-2005 , 03:59 AM






Hello there

I have database with many relationships

In sometimes i need to transfare another data from other database to the
current one, when the other database is in the same structure

The problem now is that when i delete all data from the database and use DTS
to transfare data from the other database it fails because of the
relationships.

Is there a way to transfare data from one database to other?

Or is there a way to disable the relationships only when i import data to
the database?




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

Default Re: Disabling Relationships - 09-10-2005 , 05:33 AM






Are you transferring the whole DB? If you are then BACKUP and RESTORE
is a better solution.

As for if you want to disbale some FK constraints so you can load
children before parents. Say I have a table structure of

CREATE TABLE P(p1 int identity(1,1) Primary Key, p2 int)
CREATE TABLE C(c1 int identity(1,1) Primary Key, c2p1 int references
P(p1))

--Disable the constraint
ALTER TABLE C NOCHECK CONSTRAINT FK__C__c2p1_8767G78G

--insert data
INSERT C(c2,p1) VALUES(1)

--reenable constraint
ALTER TABLE C CHECK CONSTRAINT FK__C__c2p1_8767G78G

The problem with this is you need to know the entered data is good.

UPDATE C SET c2p1 = c2p1

Allan



"Roy Goldhammer" <roy (AT) hotmail (DOT) com> wrote


Quote:
Hello there

I have database with many relationships

In sometimes i need to transfare another data from other database to the
current one, when the other database is in the same structure

The problem now is that when i delete all data from the database and use
DTS
to transfare data from the other database it fails because of the
relationships.

Is there a way to transfare data from one database to other?

Or is there a way to disable the relationships only when i import data
to
the database?


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 - 2012, Jelsoft Enterprises Ltd.