Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy database with Primary keys

Status
Not open for further replies.

neemi

Programmer
May 14, 2002
519
GB
Can someone please advice me the best way I can copt a database to another server along with all primary/foreign keys etc?

I have been using impport/export database but it looses all it keys etc.

I am new to sql server so could do with a guide etc.

Help greatly appreaciated.
Neemi
 
f yo edit the step there is an option to enable identity insert.

Paul
---------------------------------------
Shoot Me! Shoot Me NOW!!!
- Daffy Duck
 
To get the keys you need to manually script out the database objects (tables, views, etc) and recreate them on the destination server, then you can copy the data across with the import/export wizzard.

Are you using SQL 2000 or SQL 2005?

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
I am using SQL 2005.

But also have SQL 2000?
 
In the SQL 2005 GUI right click on the database, select tasks, then "Generate Scripts". This will allow you to script out the objects along with indexes, keys, etc.

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top