Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Revisiting restore procedure
Message
From
06/02/2017 10:01:20
 
 
To
All
General information
Forum:
ASP.NET
Category:
Databases
Title:
Revisiting restore procedure
Environment versions
Environment:
VB 9.0
OS:
Windows 8.1
Network:
Windows Server 2012
Database:
Visual FoxPro
Application:
Web
Miscellaneous
Thread ID:
01647592
Message ID:
01647592
Views:
72
I have a restore procedure like this:
Dim lcRestoringDatabase As String = ""
Dim loRestore As Microsoft.SqlServer.Management.Smo.Restore = New Microsoft.SqlServer.Management.Smo.Restore
Dim loServer As Microsoft.SqlServer.Management.Smo.Server = New Microsoft.SqlServer.Management.Smo.Server

loRestore.Devices.AddDevice(cPath + "\" + cDatabase + ".bak", Microsoft.SqlServer.Management.Smo.DeviceType.File)
loRestore.Database = cDatabase
loRestore.Action = Microsoft.SqlServer.Management.Smo.RestoreActionType.Database
loRestore.ReplaceDatabase = True
loRestore.PercentCompleteNotification = 1
AddHandler loRestore.PercentComplete, AddressOf ProgressEventHandler2
loRestore.SqlRestore(loServer)
I need to add support in there for something that would be able to support this extra move files such as this:

RESTORE DATABASE [MyDatabase] FROM DISK = N'D:\SQLData\MyDatabase.bak'
WITH Move 'MyDatabase' TO 'D:\SQLData\MyDirectory\MyDatabase.mdf',
MOVE 'MyDatabase_log' TO 'D:\SQLData\MyDirectory\MyDatabase.ldf',
MOVE 'Hit' TO 'D:\SQLData\MyDirectory\Hit.ndf',
MOVE 'CateFilt' TO 'D:\SQLData\MyDirectory\CateFilt.ndf',
FILE = 1, NOUNLOAD, REPLACE, STATS = 10
GO

Is that possible?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Reply
Map
View

Click here to load this message in the networking platform