Retrieve migration scripts from TFS

A SQL Server Management Studio add-in to source control your database in Subversion or Team Foundation Server.

Retrieve migration scripts from TFS

Postby jofanon » Tue Oct 08, 2013 10:03 am

What's the best way to retrieve a set of migration scripts (stored in version control using SQL Source Control) and then execute them?

Is there a method somewhere to say retrieve a reference to a set of scripts? Can anyone give me an example?

I don't want to write code that....

Connect to TFS
Get latest scripts
Identify uncommitted scripts
Executes the scripts

There must be a way of doing this through the API?
Posts: 2
Joined: Mon Oct 07, 2013 7:51 pm

Postby Evan Moss » Thu Oct 10, 2013 6:42 pm


You should be able to accomplish this by using the SQL Compare (and possibly SQL Data Compare) command line.

You'll need to create two xml files and reference them from the command line.

If you go into your extended properties for the database you're working with, you'll notice "SQLSourceControl Scripts Location" and "SQLSourceControl Migration Scripts Location". You'll need to pull the value from SQLSourceControl Scripts Location and create an xml file with that value and also create a separate xml file for the value of SQLSourceControl Migration Scripts Location.

In your command line, you'll need to include these switches:
/migrationsfolderxml:filepath for migration scripts xml
/scriptsfolderxml:filepath for scripts xml

Here's the documentation page for using the command line for SQL Compare: ... mmand+line

There are a few less complicated worked examples here: ... mmand+line

Hope that helps,
Evan Moss
Product Support
(866) 627-8107
Evan Moss
Posts: 112
Joined: Wed Jun 12, 2013 8:56 pm

Return to SQL Source Control Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests