Saturday, February 25, 2012

Copy a database

I want to make a copy of a production database on the same server, so I can
test things on the copy before I deploy them. So, after I run the copying
SQL, i will have "Northwind" and "Northwind_COPY".
Does anyone have any SQL script for this ?
Thanks,
CraigEasiest way is to backup the database and then restore into and new database
name and of course a
new set of database files. See the BACKUP and RESTORE commands in Books Onli
ne.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"Craig HB" <CraigHB@.discussions.microsoft.com> wrote in message
news:C727FC27-A191-4505-B0F6-6B963B96473D@.microsoft.com...
>I want to make a copy of a production database on the same server, so I can
> test things on the copy before I deploy them. So, after I run the copying
> SQL, i will have "Northwind" and "Northwind_COPY".
> Does anyone have any SQL script for this ?
> Thanks,
> Craig|||Hi
Backup and Restore commands (please see for more details in the BOL)
"Craig HB" <CraigHB@.discussions.microsoft.com> wrote in message
news:C727FC27-A191-4505-B0F6-6B963B96473D@.microsoft.com...
> I want to make a copy of a production database on the same server, so I
can
> test things on the copy before I deploy them. So, after I run the copying
> SQL, i will have "Northwind" and "Northwind_COPY".
> Does anyone have any SQL script for this ?
> Thanks,
> Craig|||Assuming you want the data as well, use the Import / Export Wizard (DTS)
and when given the prompt to tell it what to do, select copy data and
objects.
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.learncsharp.net/home/listings.aspx
"Craig HB" <CraigHB@.discussions.microsoft.com> wrote in message
news:C727FC27-A191-4505-B0F6-6B963B96473D@.microsoft.com...
>I want to make a copy of a production database on the same server, so I can
> test things on the copy before I deploy them. So, after I run the copying
> SQL, i will have "Northwind" and "Northwind_COPY".
> Does anyone have any SQL script for this ?
> Thanks,
> Craig

No comments:

Post a Comment