Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy one database to another database

How to copy from one database to another database.

Database name visco

I want to copy all the table from visco database to new database name as neptune

I was created one database with out any tables, then i try to restore the database from database1.bak file, then it is showing error as

You are attempting to overwrite an existing database.  Check the force restore over existing database option to 
overwrite the existing database.

Need Query Help

like image 375
JetJack Avatar asked Feb 16 '26 16:02

JetJack


2 Answers

Using the SQL Server Management Studio:

Option 1

-> Right click on the database you want to copy
-> Choose 'Tasks' > 'Generate scripts'
-> 'Select specific database objects'
-> Check 'Tables'
-> Mark 'Save to new query window'
-> Click 'Advanced'
-> Set 'Types of data to script' to 'Schema and data'
-> Next, Next :)

You can now run the generated query on the new database.

Option 2

-> Right click on the database you want to copy
-> 'Tasks' > 'Export Data'
-> Next, Next :)
-> Choose the database to copy the tables to
-> Mark 'Copy data from one or more tables or views'
-> Choose the tables you want to copy
-> Finish

like image 58
David Avatar answered Feb 18 '26 04:02

David


There is not one, but several options to achieve what you want. Your question is not very specific in that respect. You may find this article "SQL SERVER – 2008 – Copy Database With Data – Generate T-SQL For Inserting Data From One Table to Another Table" useful:

http://blog.sqlauthority.com/2009/07/29/sql-server-2008-copy-database-with-data-generate-t-sql-for-inserting-data-from-one-table-to-another-table/

If that leaves unanswered questions let us know.

like image 44
ExternalUse Avatar answered Feb 18 '26 06:02

ExternalUse



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!