A. Zalonis
A. Zalonis

Reputation: 1609

how can copy a database to an other use mssql managment studio

I have one machine only (A) and I have a databese (db1) and I want to copy this database to same machine but to a newone database db2.

I am using SQL Server Management Studio 2008 and my database is MS SQL Server 2008

How can do that

Thank you

Upvotes: 1

Views: 90

Answers (3)

A. Zalonis
A. Zalonis

Reputation: 1609

Thank @Manoj I try the solution 3 BUT first I deleted the destination databse (db2) and then made the restore and works fine.

So the solution is A. Delete Destination database B. See @Manoj Solution 3

Upvotes: 0

Manoj
Manoj

Reputation: 883

try this way when it has to be in same machine

1. RightClick on you existing database  then - Task - Restore - Database 
2. A new window will open
3. Specify new database name in "To Database"
4. Then click OK

Thanks

Manoj

Upvotes: 1

Kamil
Kamil

Reputation: 13931

Solution 1.

You can use export database feature.

  • Right-click your database in Object Explorer.
  • Click Tasks
  • Click Export Data

After this you can select source and destination.

However this will "copy" only data, stored procedures will be not copied.

Solution 2.

You can generate SQL scripts to re-create all objects in database (including stored procedures).

  • Right-click your database in Object Explorer.
  • Click Tasks
  • Click Generate Scripts

However I dont know if this will copy all objects with data in tables or just table structure.

Solution 3.

Edited.

Use backup/restore feature.

For details see Manoj answer above/below.

Upvotes: 1

Related Questions