A frustrating problem that can happen in database development is when a “change” is made to “fix” an issue that only results in producing another problem. I hope that not everyone has overheard or been in the following exchange because we all exercise perfect discipline in all stages of development:

(As a forward note, the following characters and exchange do not represent any staff members employed by DiscountASP.NET or any conversations that may have occurred in the office.)

Cecil: Hey Robespierre, there’s something wrong with your stored procedure.
Robespierre: Oh, I’ll get right on it and fix it.
Robespierre: Cecil, I’ve taken care of the problem on live.
Cecil: I don’t know what you’ve done but everything’s down!

I’ve covered using Team Foundation Server 2010 Source Control from SQL Server Management Studio but it’s limited to just covering a few scripts. What if the whole situation could’ve been avoided completely?

Since we introduced shared Team Foundation Server 2010 hosting, a product that we have had our eyes on is Red Gate’s SQL Source Control which offers the ability to source control your entire database and I’m very excited to provide you with the configuration steps as it a very excellent utility.

First, make sure that you have SQL Server Management Studio installed.

Next, I would highly recommend either creating a new Team Project and then creating a new folder or just creating a new empty folder. If you need a hand creating a new Team Project, follow the instructions in our “Creating a New Team Project (Visual Studio 2010)” Knowledge Base article.

I would highly recommend using Source Control Explorer by accessing the View menu and then selecting the Source Control Explorer option from the Other Windows menu to create a new folder. Commit the change. At this point, please note the server path as it’s something that will be required later.

Download and install the 28-day trial version of SQL Source Control 2.2 if this is something that you’re interested in evaluating and you can skip this portion if you already have the application installed. After the installation has finished, opening SQL Server Management Studio produces the following:

Connect to your database server and then select the database name:

For this article, I’ll actually be using a live database from my DiscountASP.NET web hosting account to highlight how we can use SQL Source Control across the two separate products.

Make sure that you’re under the “Setup” tab and then click on “Link database to source control.” From the next menu, select Team Foundation Server from the source control system options.

For the server URL field, you will need to append your Team Project Collection name to the URL or you’ll encounter an error suggesting that there’s some type of permission-related issue:

As an example, if you were hosted on TFS10 and your Team Project Collection name is MYTPC, the server URL that you’d want to use is https://tfs10.discountasp.net/tfs/MYTPC.

If you’re not sure what the source control folder path is, remember, you can connect to your Team Foundation Server 2010 server through Visual Studio, open Source Control Explorer (View > Other Windows > Source Control Explorer), select the folder that you created and the path will be available in the source location:

An error that you might encounter is “The path must be an empty folder” so make sure that you have created or selected an empty folder.

When the database has been added successfully, you’ll see that it’s now green:

Now, from SQL Source Control, click on the “Commit Changes” tab and then click on the “Commit” button:

I created a sample “Users” table and just added a couple of columns and then committed the table that I created.

If you open Source Control Explorer in Visual Studio and then drill-down to the Tables folder, you’ll get to see how the change is stored physically.

I decided to create a “View” using the “Users” table that I had created and you’ll also see how it gets added to source control:

We have extended 30 days free promotion all the way to the end of 2011 so if you’d like to try out the DiscountASP.NET Team Foundation Server 2010 hosting and also SQL Source Control from Red Gate, you can establish an account through the DiscountASP.NET TFS Sign Up form.

I’m also pleased to announce that Red Gate is offering a 20% discount on SQL Source Control for DiscountASP.NET customers. For more information, check the DiscountASP.NET TFS Marketplace in your TFS Control Panel and the offer is also available for our web hosting customers in the DiscountASP.NET Marketplace as well.


11 Responses to “Using Red Gate SQL Source Control with DiscountASP.NET Team Foundation Server”

  1. […] Using Red Gate SQL Source Control with DiscountASP.NET Team Foundation Server from the DiscountASP.NET Blog I really liked this post from the DiscountASP.NET team on how to use Red Gate SQL Source Control with Team Foundation Server. There are lots of Red Gate users out there as Red Gate makes terrific tools for SQL development, and those users have the same versioning needs everyone else developing databases requires. This post walks through the scenario for an ASP.NET hosted server, but you could do the same with your own TFS-server. […]

  2. Steve Lord says:

    I installed the trial and followed the instructions. When the Red Gate app goes to connect to my DiscountAsp.net TFS it times out. I tried the trial with an local TFS server and it works just fine.

  3. Steve Lord says:

    For connecting to DiscountASP.NET be sure to use port 443 not 8080

  4. […] Our friends at Falafel Software (why do I always feel hungry when I talk about them?) published a video earlier this month that demonstrates SQL Source Control using Red Gate (for which our own Joe Jun also provides a tutorial). […]

  5. […] with our TFS hosting service to source control their SQL databases. Very neat stuff. We did a blog post on this previously and our friends at Falafel Software posted a very cool video on SQL Source Control, Sitefinity and […]

  6. […] Joe blogged about how you can source control your SQL database using SQL Source Control and our TFS Hosting service. If you haven’t checked this post out, you should. Very cool stuff. Follow @takeshiDASP […]

  7. […] Their SQL Source Control product is pretty cool and Joe blogged about it previously. […]

  8. […] previously blogged about using Red Gate’s SQL Source Control and with our TFS Hosting service. This is a great tool for database source control using SQL Server Management […]

  9. […] a big fan of SQL Compare and after being impressed by SQL Source Control, I was excited when I got a message to try out a new Red Gate product, SQL […]

  10. […] learn more about the power of SQL Source Control and SQL Connect check out Joe’s blogs about Using Red Gate’s SQL Source Control and with our TFS Hosting service and Using Red Gate SQL Connect with DiscountASP.NET Team Foundation […]

  11. Me says:

    > An error that you might encounter is “The path must be an empty folder” so make sure that you have created or selected an empty folder.

    How the hack would you select an empty folder, when you want to link an existing DB to an existing repository (with scripts in it)? WTF?

Leave a Reply

iBlog by PageLines