How to deploy DB from command line in automated build?

randrand Posts: 5
My company is evaluating SQL Source Control 3.

What is the recommended way to deploy (unattended) the latest database to a SQL instance, from an automated nightly test build? We need to deploy both schema and static data to a SQL server instance for testing.

Is there a command line or do I need to use some combination of SQL Compare and Data Compare?



  • Thanks for your post.

    Currently, automating deployments like this would be done using a combination of SQL Compare and Data Compare, as you suggest- both these tools have a command-line you can use to schedule the comparison and deployment into whichever part of your process is appropriate.
    SQL Source Control itself only exists as the SSMS plugin so cannot be automated in the same way.

    Hope that helps!
    Systems Software Engineer

    Redgate Software

  • James, thanks for the response.

    Can you point me in the right direction? I want to be able to deploy the latest from source control (TFS) to either a database instance or a creation script. I need the schema and static data from source control.

    Currently we are managing the schema and data outside of source control, just in a regular SQL instance. We are using an automated task to kick off sqlpubwiz to generate a big creation script during our daily build. This works, but we want to use the sql source control product and make TFS be the storage mechanism rather than a regular sql instance.

    Any suggestions are greatly appreciated.
  • Data Compare doesn't currently support comparing directly to a source control system (although the next version due in a week or two will).

    Basically you can either compare to a source control revision directly (bearing in mind the above) or initially automate checking out a copy of your repository files (containing all the scripts) to a temporary folder somewhere. You can then use the SQL Compare command line and the SQL Data Compare command line to synchronise from the source-controlled scripts to a database (or set of script folders held elsewhere)
    Systems Software Engineer

    Redgate Software

Sign In or Register to comment.