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)
 When I inported the DB,the PK was Lost!

Author  Topic 

sunnykj
Starting Member

29 Posts

Posted - 2004-07-05 : 05:15:30
When I inported the DB,the table of this DataBase's PK was Lost!
Why? And How Can I inport a table with its PK? Thanks!

Kristen
Test

22859 Posts

Posted - 2004-07-05 : 07:02:02
How did you import the DB?

I would SCRIPT the table (Enterprise Manager : Generate SQL), run the script and then import the data

Kristen
Go to Top of Page

sunnykj
Starting Member

29 Posts

Posted - 2004-07-05 : 20:49:22
Kristen,Thanks
The DB was inported from the other DB server by the DTS inport/export Wizard ,Could I inported the DB and DB's table with its PKs by this way? If it can achieve it, how?
Sunnykj
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-07-05 : 23:05:40
Instead of selecting Copy tables and views, select Copy objects and data. Then hit next. Select the option to create and drop. You probably don't want to include dependent objects. Uncheck Copy all objects, press the Select Objects button and select your table. Uncheck Use Default options, press the Options button, and uncheck the top selection to copy database users and roles. Make sure you have Copy PRIMARY and FOREIGN keys checked.

When you import it this way, it will include the primary keys. The other option will not.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

sunnykj
Starting Member

29 Posts

Posted - 2004-07-06 : 02:38:31
I follow your steps inport it again,The problem was resolved, Thank you very much!
Go to Top of Page
   

- Advertisement -