Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to duplicate a SQL database in Microsoft SQL Server Management Studio

I need to redo some data types in a lot of tables in my SQL database and it says I need to rebuild the table, but I am very cautious on doing this because I am not certain on how to do it and dont wanna loose all the data. So I decided to try to copy the database and use it as a testing playground. The problem is I can not find how to do it or if I do its a solution form 2006 and the software interface has changed a lot since then.

like image 711
reece heald Avatar asked Mar 07 '26 18:03

reece heald


2 Answers

On sqlexpress, we can backup database to another on MSSMS (Microsoft SQL Server Management Studio) like this:

Right-Click on Databases\Restore Database... enter image description here

Then choose Source and Destination databases to copy.

enter image description here

like image 178
jacouh Avatar answered Mar 09 '26 07:03

jacouh


In MS SQL Server, the easiest way to copy your DB with another name is the copy data wizard which is available under task menu.

Right-click on DB you want to copy --> Tasks --> Copy database

It will ask basic info like source and destination server, login credential etc and will copy the DB.

enter image description here

If you using Azure SQL DB, then below command will copy any database on same server.

Create Database New_database_name as copy of Database_you_want_To_Copy
like image 32
PankajSanwal Avatar answered Mar 09 '26 06:03

PankajSanwal