How to use ApexSQL Script to deploy a database as a .Net executable

See how to script both structure and data for a database, and how to compile it into a .Net executable

The good news about the executable is that it can be executed even on the workstations without the SQL Server client tools installed

  1. Run ApexSQL Script
  2. Connect to a SQL Server instance
  3. Select a database and click Load

  4. Select the objects to script on the Structure tab

  5. On the Data tab, select the tables in views of which you want to script the data

  6. On the Home tab, in the Actions group, click Script wizard
  7. Select Structure and data in the Scripting mode page:
  8. Select Executable installer in the Output type page:

  9. Click Next
  10. Select the Include dependent database objects option to avoid constraint problems

  11. Click Next
  12. Select the options for the executable file

    1. Check Run executable now to execute the created exe file immediately after it’s been created
    2. Specify the database name, MDF and LDF file directories, collation, recovery model, and size

  13. Click Create

  14. Specify the file name and the patch for the created file. The executable file is started as soon as it’s created

  15. Select Create new database, specify the database name to create a new database, and run the file against it
  16. To specify what to do when an error is encountered, click Options and in the Error handling section choose between Abort, Ignore and Ask for confirmation options:

  17. Specify the database MDF and LDF file directories, collation, recovery model, and size on the Database properties pane:

Last updated

August 21, 2018