How to export a SQL database directly to source control

SQL database scripting tool ApexSQL Script natively integrates with the Subversion, Microsoft Visual SourceSafe, Git, SourceGear Vault, 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.

  1. Select a SQL database in the New project window and click the Open button:

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

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

  4. In the first step, choose the scripting mode and the output type, and click the Next button:

  5. In the next step, check the Include dependent database objects option, if you want to script dependent objects:

  6. In the final step of the Script wizard, in the Output file options window, is where the source control settings are offered by selecting a Create and check in to source control option, from the Output action drop-down menu, and with a click on the Edit button:

  7. 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:

  8. Once the parameters are all set up, the final step in ApexSQL Script is to simply create the SQL script using the specified Source control, with a click on the Create button:

  9. Scripting results will be shown in the final window:

Here’s an overview of the parameters for the supported Source control systems in ApexSQL Script:

Subversion

  • Username and password – The user credentials for accessing the Subversion server
  • Repository URL – The path to the source control repository, in the form [protocol]://[hostname]:[portnumber]/svn/[repository]
    • [protocol] Can be http, https, or svn, depending on the specific source control installation and on the way the Subversion service is started
    • [hostname] The machine host name, a NetBIOS name or a DNS machine name of the server where Subversion is installed
    • [portnumber] The port that will be used to access Subversion. This is 8443 by default
    • [repository] The name of the Subversion repository you want to connect to
  • Project – The source control project you want to connect to
  • Working folder – The local working folder

Microsoft Visual SourceSafe

  • Username and password – The user credentials for accessing the Microsoft Visual SourceSafe server
  • Project – The source control project you want to connect to
  • Working folder – The local working folder

SourceGear Vault

  • Username and password – The user credentials for accessing Team Foundation Server
  • Vault Server – The name and network location of the Vault server, in the form [hostname]/[vaultservice] where:
    • [hostname] IP address, a host name, a NetBIOS name or a DNS machine name of the server where SourceGear Vault is installed
    • [vaultservice] Name of your Vault Service
  • Repository – The name of the source control repository that you want to connect to
  • Project – The source control project you want to connect to
  • Working folder – The local working folder

Team Foundation Server

  • Username and password – The user credentials for accessing Team Foundation Server
  • TFS Server – The location and port for Team Foundation Server, in the form http://[hostname]:[portname] where:
    • [hostname] Hostname, a NetBIOS name or a DNS machine name of the server where Team Foundation Server is installed
    • [portname] The port that will be used to access Team Foundation Server. This is 8080 by default
  • Folder location – The folder in Team Foundation Server that stores the source control files
  • Working folder – The local working folder

Git

  • Username and password – The user credentials for accessing Team Foundation Server
  • Repository – The name of the source control repository that you want to connect to
  • Working folder – The local working folder

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

March 4, 2015