Hello

How can I clone a database in MS SQL 2005 Express? I have the original database and I want to create a new database that has to be the same as the original one.

regards,
Vedro

Recommended Answers

All 3 Replies

Here is the SQL Statements for backing up and restoring with TSQL. You should also be able to use the Microsoft SQL Management Studio if that option was selected when you installed MSDE.

--First create a backup
BACKUP DATABASE [Leather] TO  DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL\BackUpManual\Leather.bak' WITH  INIT ,  NOUNLOAD ,  NAME = N'Leather backup',  NOSKIP ,  STATS = 10,  NOFORMAT 
--Next restore it to another database
RESTORE DATABASE [Leather2] FROM  DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL\BackUpManual\Leather.bak' WITH  FILE = 1,  MOVE N'Leather_Data' TO N'D:\Microsoft SQL Server\Data\Leather2.MDF',  MOVE N'Leather_Log' TO N'D:\Microsoft SQL Server\Data\Leather2.LDF',  NOUNLOAD,  REPLACE,  STATS = 10

Hello

Thanks allot. This is what needed. It works perfectly.

This forum is great!

Regards,
vedro

Great, I was looking for something like this for last two days. Worked like a charm.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.