T-SQL syntax to force restore over existing database 
Author Message
 T-SQL syntax to force restore over existing database
What is the T-SQL syntax to force a restore of one database over an existing
database?


Sun, 10 Jul 2005 22:11:35 GMT
 T-SQL syntax to force restore over existing database

from BOL

REPLACE

Specifies that SQL Server should create the specified database and its
related files even if another database already exists with the same name. In
such a case, the existing database is deleted. When the REPLACE option is
not specified, a safety check occurs (which prevents overwriting a different
database by accident). The safety check ensures that the RESTORE DATABASE
statement will not restore the database to the current server if:

  1.. The database named in the RESTORE statement already exists on the
current server, and

  2.. The database name is different from the database name recorded in the
backup set.
REPLACE also allows RESTORE to overwrite an existing file which cannot be
verified as belonging to the database being restored. Normally, RESTORE will
refuse to overwrite pre-existing files.

--

Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


Quote:
> What is the T-SQL syntax to force a restore of one database over an
existing
> database?



Sun, 10 Jul 2005 22:22:24 GMT
 T-SQL syntax to force restore over existing database
It is the with replace option you are looking for I believe.

restore database ...
from ...
WITH REPLACE

Mike John


Quote:
> What is the T-SQL syntax to force a restore of one database over an
existing
> database?



Sun, 10 Jul 2005 22:22:03 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. Force restore over existing database?

2. restoring over an existing on SQL 6.5 database

3. Forcing users off a database before restore

4. TS/SQL --Insert a month that does not exist in the temp table

5. Force TransactionLog on Restored SQL 6.5 (with Recovery)

6. Problem while restoring to an existing database..

7. Restoring existing database to new server

8. How to drop the IDENTITY property, while keeping existing value in SQL syntax

9. Migrating Existing SQL 7 Databases to SQL 2000 Databases on New Box

10. Differences between SyBase TSQL, and SQL Server 2000 TSQL

11. TSQL Update a column if it exists

12. Syntax Check for TSQL


 
Powered by phpBB® Forum Software