Sql Server

greenspun.com : LUSENET : SQL Server Database Administration : One Thread

Pls let me know how to restore the SQL Server Database by using VB code....?? I need your valuable Help in this regard?

-- Anonymous, September 15, 2004

Answers

Saravanarajan,

You could use Transact SQL's RESTORE DATABASE command from within VB.

From the SQL Server Books Online, the syntax of the RESTORE DATABASE command is:

RESTORE DATABASE { database_name | @database_name_var } [ FROM < backup_device > [ ,...n ] ] [ WITH [ RESTRICTED_USER ] [ [ , ] FILE = { file_number | @file_number } ] [ [ , ] PASSWORD = { password | @password_variable } ] [ [ , ] MEDIANAME = { media_name | @media_name_variable } ] [ [ , ] MEDIAPASSWORD = { mediapassword | @mediapassword_variable } ] [ [ , ] MOVE 'logical_file_name' TO 'operating_system_file_name' ] [ ,...n ] [ [ , ] KEEP_REPLICATION ] [ [ , ] { NORECOVERY | RECOVERY | STANDBY = undo_file_name } ] [ [ , ] { NOREWIND | REWIND } ] [ [ , ] { NOUNLOAD | UNLOAD } ] [ [ , ] REPLACE ] [ [ , ] RESTART ] [ [ , ] STATS [ = percentage ] ] ]

Hope this helps,

Eric

-- Anonymous, September 17, 2004


Moderation questions? read the FAQ