elbillaf
elbillaf

Reputation: 1984

How to duplicate / clone a database

I have an SQL SERVER database with table, functions, stored procedures. I want to copy this database to the SAME server with a different name.

If the name of my original database is DB_ORIG and I want the copy / clone to a new database called DB_NEW, can you give me the exact commands I would use to copy the database?

Upvotes: 0

Views: 88

Answers (1)

podiluska
podiluska

Reputation: 51494

There are a number of ways.

The easiest is probably to backup the database, then restore it with the new name.

Make sure there are no views, functions or procedures that refer to the old database explicitly by name.

Upvotes: 3

Related Questions