How to restore a database during installation

ImportantThe following article uses options that are available starting with the Enterprise edition and project type.

To restore a database during installation, you can proceed as follow:

1) In the Files and Folders page you can add the .bak file as a regular file.

2) In the SQL Databases page add a sql script that will perform the restore operation under the database connection. For details regarding the sql script that can be used to restore a database, check the RESTORE Transact-SQL article.

Use the below image as a reference:

The MY_DATABASE_PATH is a property that will be set with the path of the .bak file at install time.

3) In the Script Replacement tab you can create a sql replace operation to set the property with the path of the .bak file, as below:

During installation, the MY_DATABASE_PATH property will be set with the path of the .bak file (in our case myDatabase.bak).