Tuesday, March 20, 2012

Copy database using stored procedure ?

We are using SQL Server 2005.
From my VB.NET program, I would like to call a SQL Server Stored Procedure
to copy the database to another database.
I can do that with Backup (using BACKUP DATABASE T-SQL command), but is
there a COPY DATABASE command ?
Thank you.Using BACKUP/RESTORE is a good and reliable option. There is no COPY
DATABASE command in T-SQL.
Another option to explore is using SMO (since you are using .NET). Take a
look at the links below:
http://davidhayden.com/blog/dave/archive/2006/11/09/CopyDatabaseSchemaDataSQLServerManagementObjects.aspx
http://msdn2.microsoft.com/en-us/library/microsoft.sqlserver.dts.tasks.transferdatabasetask.transferdatabasetask.aspx
HTH,
Plamen Ratchev
E-Mail: Plamen@.Ratchev.com|||fniles wrote:
> We are using SQL Server 2005.
> From my VB.NET program, I would like to call a SQL Server Stored Procedure
> to copy the database to another database.
> I can do that with Backup (using BACKUP DATABASE T-SQL command), but is
> there a COPY DATABASE command ?
> Thank you.
>
>
not heard of such command but you can still simulate COPY with
ATTACH/DETACH functions...
http://support.microsoft.com/kb/224071/
HTH,
Petar Atanasov
http://a-wake.net

No comments:

Post a Comment