Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Issues with constraints

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-10-21 : 08:55:35
Joseph Contreras writes "Hi,
I'm migrating tables from one database to another. And I'd like to know if I drop my constraints from the destination tables and then copy the data from the source will I inherit the PK/FK from the source to the destination table?

Thanks"

M.E.
Aged Yak Warrior

539 Posts

Posted - 2002-10-21 : 18:31:56
Unsure as to why your migrating it that way. Would it not be easier to backup and restore?

Just copying straight data will not bring FK's and PK's along with it. You would have to create or reenable them on the destination

-----------------------
SQL isn't just a hobby, It's an addiction
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2002-10-22 : 05:50:46
Depends on how the PKs/FKs are crated and how you do the transfer.

If you are using identities then you will have to do the copy using set identity insert on and naming the columns.

Why not just backup the database and then restore it.
Another option is transfering objects using dts.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -