Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Restore syntax

Author  Topic 

Mondeo
Constraint Violating Yak Guru

287 Posts

Posted - 2007-11-20 : 09:38:48
I have this backup procedure

BEGIN
DECLARE @path varchar(100)
SET @path = 'C:\TRANSFER.BAK'
BACKUP DATABASE DbPubMatrix
TO DISK = @path
WITH INIT
END

What is the syntax to restore this database onto another server, is it simply?

RESTORE DATABASE DbPubMatrix
FROM DISK = @path

Thanks

evilDBA
Posting Yak Master

155 Posts

Posted - 2007-11-20 : 09:45:07
[code]
RESTORE DATABASE { database_name | @database_name_var }
[ FROM <backup_device> [ ,...n ] ]
[ WITH
[ { CHECKSUM | NO_CHECKSUM } ]
[ [ , ] { CONTINUE_AFTER_ERROR | STOP_ON_ERROR } ]
[ [ , ] FILE = { file_number | @file_number } ]
[ [ , ] KEEP_REPLICATION ]
[ [ , ] MEDIANAME = { media_name | @media_name_variable } ]
[ [ , ] MEDIAPASSWORD = { mediapassword |
@mediapassword_variable } ]
[ [ , ] MOVE 'logical_file_name' TO 'operating_system_file_name' ]
[ ,...n ]
[ [ , ] PASSWORD = { password | @password_variable } ]
[ [ , ] { RECOVERY | NORECOVERY | STANDBY =
{standby_file_name | @standby_file_name_var }
} ]
[ [ , ] REPLACE ]
[ [ , ] RESTART ]
[ [ , ] RESTRICTED_USER ]
[ [ , ] { REWIND | NOREWIND } ]
[ [ , ] STATS [ = percentage ] ]
[ [ , ] { STOPAT = { date_time | @date_time_var }
| STOPATMARK = { 'mark_name' | 'lsn:lsn_number' }
[ AFTER datetime ]
| STOPBEFOREMARK = { 'mark_name' | 'lsn:lsn_number' }
[ AFTER datetime ]
} ]
[ [ , ] { UNLOAD | NOUNLOAD } ]
[/code]

Now could I ask you a question?
I am really curious.
It took about 10 seconds for me to find it. As you use SQL server, you also have Books Online installed.
So, you can find it on your own in 10 seconds, or wait hours, sometimes days for a reply in the forum
I am not judging you, there as so many people are doing the same,
but let me ask, WHY????
Go to Top of Page

georgev
Posting Yak Master

122 Posts

Posted - 2007-11-20 : 12:57:27
quote:
As you use SQL server, you also have Books Online installed.

Not entirely true, the installations I have do not contain the help files...

...although BoL is still available online (funnily enough)
quote:

but let me ask, WHY????


This time last year I had no idea what BoL was ;)

George
<3Engaged!
Go to Top of Page
   

- Advertisement -