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
 SQL Server Administration (2000)
 Database Import questions?

Author  Topic 

adlo
Posting Yak Master

108 Posts

Posted - 2004-10-15 : 14:27:35
I have two quesions regarding the import funtion is SQL Server.

1. How do I just import the database diagram (relationships) from one database to another?

2. When I import a table from one database to another it does not import the primary key settings and I have to manually set the primary keys in the new table. How do I get around this?

Thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-10-15 : 14:35:44
1. Database diagram is stored in dtproperties, so you can import/export from that table.

2. Don't use the import wizard to copy/move databases. Use BACKUP/RESTORE commands to get everything.



Tara
Go to Top of Page

adlo
Posting Yak Master

108 Posts

Posted - 2004-10-15 : 15:06:56
Thanks

The test databse (FROM) has dummy data
and the live database (TO)
has the proper data.

I can't restore the database as the data in certain tables on the the different databases are different and must stay that way.

Any ideas to import the primary key settings?







Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-10-15 : 15:09:01
Generate the DDL for the PKs at the source using the Generate SQL script wizard, then run the script on your test database.

For future imports/exports, I would use bcp to get the specific data that you want. Don't recreate the tables on your test database. Create them exactly how you want them to look. Then have a job that deletes the data from them, then bcps the data out from the source and bcps in at the destination. You can DTS for this as well, but you'll have to write a package.

Tara
Go to Top of Page

adlo
Posting Yak Master

108 Posts

Posted - 2004-10-15 : 15:42:08
Thanks
Go to Top of Page
   

- Advertisement -