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 Open

  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 Actionsgroup, click Script wizard
  7. Select Structure and data in the Scripting mode drop-down list
  8. Select .NET executable in the Output type drop-down list

  9. Click Next
  10. Select the Include dependent database objectsoption 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 select the Error handling tab

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

Last updated
April 7, 2013