How to export a SQL database directly to source control

SQL database scripting tool ApexSQL Script natively integrates with the Git, Mercurial, Perforce, Subversion, and Team Foundation Server source control systems.

ApexSQL Script allows to export complete SQL database, or just a couple of its objects, to one of the mentioned source control systems by following these steps:

  1. Connect to a SQL Server, select a SQL database in the New project window and click the Load button:

    SQL database selection in the New project window

  2. By changing Views, to Structure or Data, in the Home tab, select the desired objects and data that will be included in exporting to source control:

    Choose between Structure and Data view grids in the main application window

  3. When all desired objects are checked, click the Script button, in the Home tab, of the main window, to run the Script wizard:

    Initiate the Script wizard from the main application window

  4. In the next two steps choose the Scripting modeStructure and data in this case and the Output typeSource control output type as a database will be exported to source control, and click the Next button:

    Scripting mode step in the Script wizard

    Output type step in the Script wizard

  5. In the next step, the Include dependent objects option is checked by default, which means that all dependent objects will be included, or uncheck it if there is need to for them:

  6. Dependencies step in the Script wizard

  7. In the final step of the Script wizard, the source control settings need to be set with a click on the Setup button:

    Source control options settings in the Script wizard

  8. The Source control wizard is opened, and the following settings are pretty much known to the users who have had the experience with source control, selecting a source control type and setting up the credentials and repository parameters:

    Source control system in the Connection type tab of the Source control wizard

    Source control login settings in the System login tab of the Source control wizard

  9. Once the parameters are all set up, the final step in ApexSQL Script is to click on the Commit button and the exporting to source control repository will begin:

    Source control options information in the Script wizard

  10. Once finished, the Results dialog will be shown:

    Results dialog with the information about the execution results

Source control is essential in all applications that have many different release versions of a product. ApexSQL Script allows users to explore the changes and SQL script iterations over different versions by leveraging common source control providers.

 

March 4, 2015