{"id":1405,"date":"2012-10-09T00:00:00","date_gmt":"2012-09-19T00:00:00","guid":{"rendered":"https:\/\/test.simple-talk.com\/uncategorized\/database-source-control-basics-getting-started\/"},"modified":"2021-05-11T15:57:26","modified_gmt":"2021-05-11T15:57:26","slug":"database-source-control-basics-getting-started","status":"publish","type":"post","link":"https:\/\/www.red-gate.com\/simple-talk\/databases\/sql-server\/tools-sql-server\/database-source-control-basics-getting-started\/","title":{"rendered":"Database Source Control Basics: Getting Started"},"content":{"rendered":"<div id=\"pretty\">\n<h2>You&#8217;ve Been Doing Source Control Wrong&#8230; and How to Fix It<\/h2>\n<ul>\n<li><a href=\"#introduction\">Intro<\/a><\/li>\n<li><a href=\"#logistics\">Logistics and Setup<\/a>\n<ul>\n<li><a href=\"#gettingthetools\">Getting the Tools<\/a><\/li>\n<li><a href=\"#installing\">Installing<\/a><\/li>\n<li><a href=\"#updating\">Updating<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#gettingstarted\">Getting Started<\/a>\n<ul>\n<li><a href=\"#opening\">Opening SQL Source Control<\/a><\/li>\n<li><a href=\"#gettinghelp\">Getting Help<\/a><\/li>\n<li><a href=\"#linkingdb\">Linking a Database to Source Control<\/a><\/li>\n<li><a href=\"#examining\">Examining Your New World<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2 id=\"intro\">Introduction<\/h2>\n<p><strong><em>I will <\/em><\/strong><strong><em>explain <\/em><\/strong><strong><em>the <\/em><\/strong><strong><em>rather <\/em><\/strong><strong><em>incendiary<\/em><\/strong><strong><em>\u00a0heading at the start of this article\u00a0in just a moment, but first<\/em><\/strong><strong><em>&#8230;<\/em><\/strong><strong><em>.<\/em><\/strong><\/p>\n<p class=\"start\">It might, at first, seem strange to want to put your database in source control. Why on earth would you want your database in source control? How is it possible to put gigabytes or more in source control? How does it mesh with your codebase?<\/p>\n<p>As to the first question, databases should be in source control for many of the same reasons as application code:<\/p>\n<ul>\n<li><strong>Protect production systems from uncontrolled changes.<\/strong><br \/>\n Ensures that the code that you have tested is exactly what gets deployed; eliminating manual steps eliminates room for inadvertent deployment errors.<\/li>\n<li><strong>Track changes.<\/strong><br \/>\n All code and script changes are itemized and documented (with commit messages) allowing for easier bug diagnosis, rollbacks, and code reviews. Furthermore, you can see how individual objects evolve over time and why, as well as identify who made changes.<\/li>\n<li><strong>Support team work.<\/strong><br \/>\n Ensures that each developer is always working on the latest code (scripts).<\/li>\n<li><strong>Manage code complexity.<\/strong><br \/>\n Branches allow parallel development on different features and bug fixes.<\/li>\n<li><strong>Facilitate testing.<\/strong><br \/>\n Easier to release code for testing in a continuous integration environment where code and database elements must be coordinated.<\/li>\n<li><strong>Make it easy to undo changes.<\/strong><br \/>\n Whether you just made a change and realized it was wrong, or found a bug from some time back and need to undo a change, revision history allows you to go back to earlier versions quickly and easily.<\/li>\n<li><strong>Provide a safe sandboxing environment.<\/strong><br \/>\n To test out a change, you can work on a branch so as not to affect mainline code being worked by other developers.<\/li>\n<li><strong>Enhance good programming practices.<\/strong><br \/>\n You should review all your changes before committing; you can formulate a more accurate summary for the commit message as well as make sure typos or other stray artifacts did not sneak into your code inadvertently.<\/li>\n<\/ul>\n<p>Beyond my own experiences, this summary is synthesized from Simple-Talk&#8217;s <a href=\"http:\/\/www.simple-talk.com\/sql\/t-sql-programming\/database-source-control---the-cribsheet\/\">Database Source Control- The Crib Sheet<\/a>, and BetterExplained&#8217;s <a href=\"http:\/\/betterexplained.com\/articles\/a-visual-guide-to-version-control\/\">A Visual Guide to Version Control.<\/a><\/p>\n<p>As to <em>how<\/em> to put a database in source control: you are not storing the <em>data<\/em> contained in the database only the <em>structure<\/em> of the data, the schema that describes the tables, triggers, views, etc. Your data does not belong in source control just as, for example, certain files in Visual Studio that store your personal preferences do not belong in source control. In the latter case, those settings belong exclusively to you. In the database case, it is irrelevant to the current version of your software whether you have 1000 records or 1001 records in your customer table. That said, there is a useful exception to consider: static (or lookup or reference) data, i.e. data that is non-transactional that your application depends on. A simple example of this might be a table of US area codes, which went through a major &#8220;rewrite&#8221; a few years ago but before that they were probably invariant for fifty years or more. So it might be useful to have the data in this lookup table under source control because your code might actually be hard-coded for specific values.<\/p>\n<p><strong><em>Now back to what you have been doing wrong.<\/em><\/strong><\/p>\n<div>\n<table>\n<tbody>\n<tr>\n<td valign=\"top\">\n<p>Source control best practice<\/p>\n<\/td>\n<td>\n<p>Each commit should be for a <strong><em>single<\/em><\/strong> reason.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>When you decide that a database should be source-controlled, this has ramifications for the way you develop software. While there are always exceptions, the following principles of source control are worth following:<\/p>\n<p>Even if you are working on several bug fixes simultaneously, it is much cleaner if you separate those changes and commit each change individually, whether that change involves one file or a dozen files. If you follow this guideline you then have the ability to back out a specific bug fix should the need arise. Also, on the occasion where you need to review your history (i.e. commit log) to find something it is much easier to do this when each commit is done for a single reason.<\/p>\n<p>The converse of that principle is:<\/p>\n<div>\n<table>\n<tbody>\n<tr>\n<td valign=\"top\">\n<p>Source control best practice<\/p>\n<\/td>\n<td>\n<p>A single reason should be committed <em><strong>atomically<\/strong><\/em>.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>That is, once you decide on the reason you are making a commit, everything connected to that reason should be included. If, for example, you are fixing Defect 134A923-123, then <em>all<\/em> the changes for it-user interface code, application code, help text, <em>and database schema<\/em>-should be committed together. This again aids clarity when reviewing history, investigating introduced defects, etc., but most importantly it supports this final, important principle:<\/p>\n<div>\n<table>\n<tbody>\n<tr>\n<td valign=\"top\">\n<p>Source control best practice<\/p>\n<\/td>\n<td>\n<p>A commit should never break the build.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>It follows that if you are not source controlling your database or you are not committing schema changes together with code changes you cannot help but violate this principle. And that is the justification for the first half of the title of this article, &#8220;You&#8217;ve Been Doing Source Control Wrong&#8230;&#8221; The remainder of this series addresses the second half of the title, &#8220;&#8230;and How to Fix It,&#8221; giving you the wherewithal to put in practice the source control best practices just shown.<\/p>\n<p>This article is in three parts:<\/p>\n<p><strong>Part 1<\/strong> goes in-depth regarding the missing link for getting started with source control from SQL Server Management Studio using <strong>SQL Source Control<\/strong>.<\/p>\n<p><strong>In Part 2<\/strong> I&#8217;ll walk through the basic commit and update actions familiar to any source control user but described in the context of SQL Source Control. I&#8217;ll then tackle the practical steps for rolling back a database to a previous revision as well as deploying a database from source control, including the vital mechanism of migration scripts provided by SQL Compare.<\/p>\n<p><strong>Part 3<\/strong> takes you from SSMS to Visual Studio, when I&#8217;ll introduce SQL Connect, the key to bringing your database into your project so that your source control plugin can handle them both. The last section of part 3 then zooms back out from the trees to look at the forest, explaining what I call the <em>grand unified <\/em><em>field theory for source control<\/em>: connecting your database, your source control, and your project, and using them <em>harmoniously<\/em>.<\/p>\n<p><em>To be honest, the most interesting part is that last half of part 3-how everything fits together. But <\/em><em>you&#8217;ll appreciate that much more once you have a feel for the mechanics of all the components.<\/em><\/p>\n<h2 id=\"logistics\">Logistics and Setup<\/h2>\n<h3 id=\"gettingthetools\">Getting the Tools<\/h3>\n<p><strong>SQL Source Control<\/strong> allows you to source-control your database within SQL Server Management Studio (SSMS); but to really make effective use of SQL Source Control you also need <strong>SQL Compare<\/strong>, which is the component that does source control rollbacks and database deployments. You&#8217;ll need <strong>SQL Connect<\/strong>as well if you need to connect your database to Visual Studio. Fairly soon, as a developer, it will cost you less if you purchase one of the two packaged suites from Red Gate, itemized in the table below.<\/p>\n<div>\n<table class=\"MsoTableLightShadingAccent3\">\n<tbody>\n<tr>\n<td colspan=\"2\" valign=\"top\">\n<p><b>Product<\/b><\/p>\n<\/td>\n<td valign=\"top\">\n<p><b><a href=\"http:\/\/www.red-gate.com\/products\/sql-development\/sql-toolbelt\/?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqltoolbelt\">SQL Toolbelt<\/a><\/b><\/p>\n<\/td>\n<td valign=\"top\">\n<p><b><a href=\"http:\/\/www.red-gate.com\/products\/sql-development\/sql-developer-bundle\/?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqldeveloperbundle\">SQL<br \/>\n Developer Bundle<\/a><\/b><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><a href=\"http:\/\/www.red-gate.com\/products\/sql-development\/sql-compare?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqlcompare\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-Compare.png\" alt=\"1562-Compare.png\" width=\"50\" \/><\/a><\/td>\n<td valign=\"top\">\n<p><a href=\"http:\/\/www.red-gate.com\/products\/sql-development\/sql-compare?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqlcompare\">SQL Compare Pro<\/a><br \/>\n Compares and synchronizes SQL Server database schemas<\/p>\n<\/td>\n<td valign=\"top\">\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-redtick.gif\" alt=\"1562-redtick.gif\" \/><\/p>\n<\/td>\n<td valign=\"top\">\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-redtick.gif\" alt=\"1562-redtick.gif\" \/><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><a href=\"http:\/\/www.red-gate.com\/products\/sql-development\/sql-data-compare?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=datacompare\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-datacompare.png\" alt=\"1562-datacompare.png\" width=\"50\" \/><\/a><\/td>\n<td valign=\"top\">\n<p><a href=\"http:\/\/www.red-gate.com\/products\/sql-development\/sql-data-compare?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=datacompare\">SQL Data Compare Pro<\/a><br \/>\n Compares and synchronizes SQL Server database contents<\/p>\n<\/td>\n<td valign=\"top\">\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-redtick.gif\" alt=\"1562-redtick.gif\" \/><\/p>\n<\/td>\n<td valign=\"top\">\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-redtick.gif\" alt=\"1562-redtick.gif\" \/><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><a href=\"http:\/\/www.red-gate.com\/products\/sql-development\/sql-source-control?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqlsourcecontrol\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-soc.png\" alt=\"1562-soc.png\" width=\"50\" \/><\/a><\/td>\n<td valign=\"top\">\n<p><a href=\"http:\/\/www.red-gate.com\/products\/sql-development\/sql-source-control?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqlsourcecontrol\">SQL Source Control <\/a><br \/>\n Connect your existing source control system to SQL Server<\/p>\n<\/td>\n<td valign=\"top\">\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-redtick.gif\" alt=\"1562-redtick.gif\" \/><\/p>\n<\/td>\n<td valign=\"top\">\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-redtick.gif\" alt=\"1562-redtick.gif\" \/><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><a href=\"http:\/\/www.red-gate.com\/products\/sql-development\/sql-prompt?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqlprompt\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-prompt.png\" alt=\"1562-prompt.png\" width=\"50\" \/><\/a><\/td>\n<td valign=\"top\">\n<p><a href=\"http:\/\/www.red-gate.com\/products\/sql-development\/sql-prompt?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqlprompt\">SQL Prompt Pro<\/a><br \/>\n Write, edit, and explore SQL effortlessly<\/p>\n<\/td>\n<td valign=\"top\">\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-redtick.gif\" alt=\"1562-redtick.gif\" \/><\/p>\n<\/td>\n<td valign=\"top\">\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-redtick.gif\" alt=\"1562-redtick.gif\" \/><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><a href=\"http:\/\/www.red-gate.com\/products\/sql-development\/sql-connect\/?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqlconnect\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-connect.png\" alt=\"1562-connect.png\" width=\"50\" \/><\/a><\/td>\n<td valign=\"top\">\n<p><a href=\"http:\/\/www.red-gate.com\/products\/sql-development\/sql-connect\/?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqlconnect\">SQL Connect<\/a><br \/>\n Ingeniously simple database development in Visual Studio<\/p>\n<\/td>\n<td valign=\"top\">\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-redtick.gif\" alt=\"1562-redtick.gif\" \/><\/p>\n<\/td>\n<td valign=\"top\">\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-redtick.gif\" alt=\"1562-redtick.gif\" \/><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><a href=\"http:\/\/www.red-gate.com\/products\/sql-development\/sql-test\/?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqltest\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-sqltest.png\" alt=\"1562-sqltest.png\" width=\"50\" \/><\/a><\/td>\n<td valign=\"top\">\n<p><a href=\"http:\/\/www.red-gate.com\/products\/sql-development\/sql-test\/?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqltest\">SQL Test<\/a><br \/>\n Unit test databases in SQL Server Management Studio<\/p>\n<\/td>\n<td valign=\"top\">\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-redtick.gif\" alt=\"1562-redtick.gif\" \/><\/p>\n<\/td>\n<td valign=\"top\">\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-redtick.gif\" alt=\"1562-redtick.gif\" \/><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><a href=\"http:\/\/www.red-gate.com\/products\/sql-development\/sql-data-generator?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqldatagerator\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-datagenerator.png\" alt=\"1562-datagenerator.png\" width=\"50\" \/><\/a><\/td>\n<td valign=\"top\">\n<p><a href=\"http:\/\/www.red-gate.com\/products\/sql-development\/sql-data-generator?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqldatagerator\">SQL Data Generator<\/a><br \/>\n Test data generator for SQL Server databases<\/p>\n<\/td>\n<td valign=\"top\">\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-redtick.gif\" alt=\"1562-redtick.gif\" \/><\/p>\n<\/td>\n<td valign=\"top\">\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-redtick.gif\" alt=\"1562-redtick.gif\" \/><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><a href=\"http:\/\/www.red-gate.com\/products\/sql-development\/sql-packager?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqlpackager\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-packager.png\" alt=\"1562-packager.png\" width=\"50\" \/><\/a><\/td>\n<td valign=\"top\">\n<p><a href=\"http:\/\/www.red-gate.com\/products\/sql-development\/sql-packager?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqlpackager\">SQL Packager<\/a><br \/>\n Packages a database for deployment or update<\/p>\n<\/td>\n<td valign=\"top\">\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-redtick.gif\" alt=\"1562-redtick.gif\" \/><\/p>\n<\/td>\n<td valign=\"top\">\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-redtick.gif\" alt=\"1562-redtick.gif\" \/><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><a href=\"http:\/\/www.red-gate.com\/products\/sql-development\/sql-dependency-tracker?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqldependencytracker\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-dependencytracker.png\" alt=\"1562-dependencytracker.png\" width=\"50\" \/><\/a><\/td>\n<td valign=\"top\">\n<p><a href=\"http:\/\/www.red-gate.com\/products\/sql-development\/sql-dependency-tracker?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqldependencytracker\">SQL Dependency Tracker<\/a><br \/>\n Visualizes SQL Server object dependencies<\/p>\n<\/td>\n<td valign=\"top\">\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-redtick.gif\" alt=\"1562-redtick.gif\" \/><\/p>\n<\/td>\n<td valign=\"top\">\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-redtick.gif\" alt=\"1562-redtick.gif\" \/><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><a href=\"http:\/\/www.red-gate.com\/products\/sql-development\/sql-doc?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqldoc\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-sqldoc.png\" alt=\"1562-sqldoc.png\" width=\"50\" \/><\/a><\/td>\n<td valign=\"top\">\n<p><a href=\"http:\/\/www.red-gate.com\/products\/sql-development\/sql-doc?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqldoc\">SQL Doc<\/a><br \/>\n Document SQL Server databases<\/p>\n<\/td>\n<td valign=\"top\">\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-redtick.gif\" alt=\"1562-redtick.gif\" \/><\/p>\n<\/td>\n<td valign=\"top\">\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-redtick.gif\" alt=\"1562-redtick.gif\" \/><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><a href=\"http:\/\/www.red-gate.com\/products\/dba\/sql-multi-script?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqlmultiscript\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-multiscript.png\" alt=\"1562-multiscript.png\" width=\"50\" \/><\/a><\/td>\n<td valign=\"top\">\n<p><a href=\"http:\/\/www.red-gate.com\/products\/dba\/sql-multi-script?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqlmultiscript\">SQL Multi Script Unlimited<\/a><br \/>\n Single-click script execution on multiple servers<\/p>\n<\/td>\n<td valign=\"top\">\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-redtick.gif\" alt=\"1562-redtick.gif\" \/><\/p>\n<\/td>\n<td valign=\"top\">\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-redtick.gif\" alt=\"1562-redtick.gif\" \/><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><a href=\"http:\/\/www.red-gate.com\/products\/dba\/sql-backup\/?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqlbackup\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-backup.png\" alt=\"1562-backup.png\" width=\"50\" \/><\/a><\/td>\n<td valign=\"top\">\n<p><a href=\"http:\/\/www.red-gate.com\/products\/dba\/sql-backup\/?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqlbackup\">SQL Backup Pro<\/a><br \/>\n Compress, securely encrypt and strengthen backups &#8211; fast<\/p>\n<\/td>\n<td valign=\"top\">\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-redtick.gif\" alt=\"1562-redtick.gif\" \/><\/p>\n<\/td>\n<td valign=\"top\">\u00a0<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><a href=\"http:\/\/www.red-gate.com\/products\/dba\/sql-monitor\/?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqlmonitor\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-monitor.png\" alt=\"1562-monitor.png\" width=\"50\" \/><\/a><\/td>\n<td valign=\"top\">\n<p><a href=\"http:\/\/www.red-gate.com\/products\/dba\/sql-monitor\/?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqlmonitor\">SQL Monitor<\/a><br \/>\n SQL Server performance monitoring and alerting<\/p>\n<\/td>\n<td valign=\"top\">\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-redtick.gif\" alt=\"1562-redtick.gif\" \/><\/p>\n<\/td>\n<td valign=\"top\">\u00a0<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><a href=\"http:\/\/www.red-gate.com\/products\/sql-development\/sql-comparison-sdk\/?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqlcomparisonsdk\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-comparison.png\" alt=\"1562-comparison.png\" width=\"50\" \/><\/a><\/td>\n<td valign=\"top\">\n<p><a href=\"http:\/\/www.red-gate.com\/products\/sql-development\/sql-comparison-sdk\/?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqlcomparisonsdk\">SQL Comparison SDK<\/a><br \/>\n Automate comparison and synchronization tasks<\/p>\n<\/td>\n<td valign=\"top\">\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-redtick.gif\" alt=\"1562-redtick.gif\" \/><\/p>\n<\/td>\n<td valign=\"top\">\u00a0<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><a href=\"http:\/\/www.red-gate.com\/products\/dba\/sql-olr-native\/?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqlolrnative\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-objectlevelrecovery.png\" alt=\"1562-objectlevelrecovery.png\" width=\"50\" \/><\/a><\/td>\n<td valign=\"top\">\n<p><a href=\"http:\/\/www.red-gate.com\/products\/dba\/sql-olr-native\/?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqlolrnative\">SQL Object Level Recovery Native<\/a><br \/>\n Recover database objects from SQL Server backups<\/p>\n<\/td>\n<td valign=\"top\">\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-redtick.gif\" alt=\"1562-redtick.gif\" \/><\/p>\n<\/td>\n<td valign=\"top\">\u00a0<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\"><a href=\"http:\/\/www.red-gate.com\/products\/sql-development\/sql-search\/?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqlsearch\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-sqlsearch.png\" alt=\"1562-sqlsearch.png\" width=\"50\" \/><\/a><\/td>\n<td valign=\"top\">\n<p><a href=\"http:\/\/www.red-gate.com\/products\/sql-development\/sql-search\/?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqlsearch\">SQL Search<\/a><br \/>\n Search within SQL Server database schemas<\/p>\n<\/td>\n<td valign=\"top\">\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-redtick.gif\" alt=\"1562-redtick.gif\" \/><\/p>\n<\/td>\n<td valign=\"top\">\n<p><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-redtick.gif\" alt=\"1562-redtick.gif\" \/><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h3 id=\"installing\">Installing<\/h3>\n<p>The <strong>SQL Toolbelt<\/strong> installer operates similarly to the Microsoft Office installer in that it allows you to select or deselect any of the individual products and install them together. The installer displays just a few products at a time, so there are four screens of choices to walk through for SQL Toolbelt.<\/p>\n<p>For all the products that require prerequisites, the installer will list the prerequisites if you do not have them already installed. For some products, where this dependency is straightforward, the installer can automatically install the prerequisite (e.g. SQL Dependency Tracker requires Visual J#). For other products, you will not be able to select them for installation until you first install the prerequisite. SQL Source Control and a few others, for example, require SQL Server Management Studio, as shown in Figure 1.<\/p>\n<p class=\"illustration\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-installer-7c11a33b-9473-4165-8bda-aa27aa45fe59.jpg\" alt=\"1562-installer-7c11a33b-9473-4165-8bda-a\" \/><\/p>\n<p class=\"caption\">Figure 1: The Red Gate installer handles simple dependencies automatically; ones that you need to do manually are clearly indicated, such as SQL Source Control&#8217;s dependency on SQL Server Management Studio.<\/p>\n<h3 id=\"updating\">Updating<\/h3>\n<p>Once you have installed SQL Source Control, you can manually check for product updates via the help menu, as with most programs; the system presents the dialog shown in Figure 2. Here, you will also find the option to check for updates automatically, if you prefer. When an update is available you get all the information you need to decide whether the update is something you will find immediately useful or not: the version you currently have installed; the version of the update; the size of the download; and a link to what the update contains.<\/p>\n<p class=\"illustration\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-upgrade%20notice-d1d1b14d-9b26-421d-9ca2-aa1d862a9ea9.jpg\" alt=\"1562-upgrade%20notice-d1d1b14d-9b26-421d\" \/><\/p>\n<p class=\"caption\">Figure 2: Update notification from SQL Source Control, letting you know what you have vs. what is now available.<\/p>\n<p>As an alternative update mechanism, you might prefer to download the entire SQL Toolbelt (or SQL Developer Bundle); this allows you to update several products at the same time. The SQL Toolbelt installer is almost as informative as the in-program update check-for products that you have installed previously it tells you the version you have and the version it can update to-see Figure 3.<\/p>\n<p class=\"illustration\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-upgrade%20installer%20launch-28c4dd7f-ea92-4426-a87c-314507d99dab.jpg\" alt=\"1562-upgrade%20installer%20launch-28c4dd\" \/><\/p>\n<p class=\"caption\">Figure 3: The installer lets you install new tools as well as updates, again letting you know what you already have installed and what the latest version is.<\/p>\n<h2 id=\"gettingstarted\">Getting Started<\/h2>\n<p>If you have used &#8220;ordinary&#8221; source control for project files, you may have used TortoiseSVN or a similar GUI client to interface to your source control repository. TortoiseSVN is not a standalone application; it integrates into Windows Explorer to provide source control support for your routine file operations. Similarly, SQL Source Control integrates into SQL Server Management Studio (SSMS) to provide source control support for your routine database operations.<\/p>\n<p>You expose a portion of TortoiseSVN&#8217;s GUI by opening the context menu on one or more files or folders and selecting an operation on the TortoiseSVN sub-menu. In SSMS, on the other hand, all of the SQL Source Control functionality is clustered into a single interface that you can open in several different ways-just look for the SQL Source Control <a href=\"http:\/\/en.wikipedia.org\/wiki\/Taijitu\">taijitu<\/a> icon scattered about the SSMS interface (Figure 4).<\/p>\n<p class=\"illustration\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-launch%20ssc-379d64f6-392d-4844-8fea-b26510f898fa.jpg\" alt=\"1562-launch%20ssc-379d64f6-392d-4844-8fe\" \/><\/p>\n<p class=\"caption\">Figure 4: Look for the stylized taijitu symbol to access SQL Source: on a toolbar, in the Tools menu, or in the Object Explorer.<\/p>\n<h3 id=\"opening\">Opening SQL Source Control<\/h3>\n<p>when you activate any of these controls, SQL Source Control opens a single new tab in SSMS alongside any other tabs you may have open for queries, table designers, etc. This single tab, however, contains four sub-tabs (Figure 5).<\/p>\n<ul>\n<li><strong>Commit Changes<\/strong>: equivalent to TortoiseSVN&#8217;s SVN Commit&#8230; command, this takes your local changes and publishes them to the source control repository.<\/li>\n<li><strong>Get Latest<\/strong>: equivalent to TortoiseSVN&#8217;s SVN Update command, this brings down any published changes into your working copy.<\/li>\n<li><strong>Migrations<\/strong>: Unique to SQL Source Control, this provides a mechanism to avoid data loss during deployment and to avoid manually making configuration changes with each deployment.<\/li>\n<li><strong>Setup<\/strong>: This manages the connection between your database and your source control repository.<\/li>\n<\/ul>\n<p class=\"illustration\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-sqlSourceControl_virgin-ae439a51-38b7-470c-a1cd-2a3616d0edbc.jpg\" alt=\"1562-sqlSourceControl_virgin-ae439a51-38\" \/><\/p>\n<p class=\"caption\">Figure 5: SQL Source Control opens as a normal tab in SQL Server Management Studio (background). Its tab contains 4 sub-tabs (foreground). The Setup tab comes to the fore upon opening; with nothing selected in the object explorer its contents provide basic explanatory material.<\/p>\n<p>Typically, the Setup tab opens automatically the first time that you use SQL Source Control because you must first specify a connection to source control before you can use it. Figure 5 shows the panel when you have nothing selected in the object explorer. It changes to Figure 6 once you select a database that you have <em>not<\/em> yet connected to source control, giving you the ability to establish the connection, and explaining the two available models of database use. This latter point is especially useful, providing the flexibility for you to work the way you prefer. You might be adamant about all developers sharing the same database or just as adamant about each one using a private copy of the database. A simple selection lets you pick the model that is right for you.<\/p>\n<p class=\"illustration\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-sqlSourceControl_selected-aca1aa8a-8b81-43df-b7b3-7559f47b8ddc.png\" alt=\"1562-sqlSourceControl_selected-aca1aa8a-\" \/><\/p>\n<p class=\"caption\">Figure 6: Once you select a database not connected to source control, SQL Source Control provides a link to establish a connection (top) and explains the two data models from which you will need to select (bottom).<\/p>\n<p>The third and final variation of the Setup sub-tab (Figure 7) shows what you get when you select a connected database in the object explorer.<\/p>\n<p class=\"illustration\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-sqlSourceControl_linked-9e75bcf5-be8c-4820-b971-2e0150fff5cb.png\" alt=\"1562-sqlSourceControl_linked-9e75bcf5-be\" \/><\/p>\n<p class=\"caption\">Figure 7: When you select a connected database, SQL Source Control displays the details of that connection (top). Because it is so crucial, it retains the description of the two available data models (bottom).<\/p>\n<h3 id=\"gettinghelp\">Getting Help<\/h3>\n<p>Before continuing with using SQL Source Control, this section provides a brief interlude on your help options, available from the pull-down menu at the upper right (Figure 8)<\/p>\n<ul>\n<li><strong>Help Contents:<\/strong> This takes you to the <a href=\"http:\/\/www.red-gate.com\/supportcenter\/Content\/SQL_Source_Control\/help\/3.0\/SSC_Getting_Started?utm_source=simpletalk&amp;utm_medium=article&amp;utm_content=msorens_sourcecontrolpt1&amp;utm_campaign=sqlsourcecontrol\">Getting Started<\/a> section on the Red Gate website for published material.<\/li>\n<li><strong>Support Forum:<\/strong> This opens the <a href=\"https:\/\/forum.red-gate.com\/categories\/sql-source-control-5\">SQL Source Control forum<\/a> where you may browse existing questions or ask your own.<\/li>\n<li><strong>Feedback:<\/strong> Unique to Red Gate products, the <a href=\"http:\/\/redgate.uservoice.com\/forums\/39019-sql-source-control\">Feedback forum<\/a> has some overlap with the support forum above in that you can ask questions, but the main focus of the feedback page is to tabulate customer interest in proposed features.<\/li>\n<\/ul>\n<p class=\"illustration\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-help%20choices-91d0240c-f5a3-41f9-9340-2b1df4aad800.jpg\" alt=\"1562-help%20choices-91d0240c-f5a3-41f9-9\" \/><\/p>\n<p class=\"caption\">Figure 8: Available choices from the help menu of SQL Source Control.<\/p>\n<h3 id=\"linkingdb\">Linking a Database to Source Control<\/h3>\n<p>To link a database to source control, select the link shown in Figure 6 on the <strong>Setup<\/strong> tab. This opens the linking dialog shown in Figure 9, allowing you to select your source control system and specify its parameters, and to select your database model. SQL Source Control explicitly provides support for <a href=\"http:\/\/subversion.apache.org\/\">Subversion<\/a>, <a href=\"https:\/\/www.visualstudio.com\/tfs\/\">Team Foundation Server<\/a>, and <a href=\"http:\/\/www.sourcegear.com\/vault\/\">Vault<\/a>, but it can also connect to other source control systems as indicated under the <strong>More<\/strong> choice: <a href=\"http:\/\/git-scm.com\/\">Git<\/a>, <a href=\"https:\/\/www.mercurial-scm.org\/\">Mercurial<\/a>, <a href=\"https:\/\/www.perforce.com\/\">Perforce<\/a>, and, in fact, any source control system that has a command line interface.<\/p>\n<p class=\"illustration\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-link%20dialog-ccb28986-ac0a-4923-8c19-87054824af46.jpg\" alt=\"1562-link%20dialog-ccb28986-ac0a-4923-8c\" \/><\/p>\n<p class=\"caption\">Figure 9: Select your source control system then enter appropriate parameters to link your database to it; here Subversion is selected, which requires just a database repository address.<\/p>\n<p>Note that, for Subversion, the URL must point to the actual Subversion repository, not just the server upon which it resides, even though that is the default value for the field. If you just select <strong>Browse<\/strong> with the default, that invalid repository address yields an error (Figure 10).<\/p>\n<p class=\"illustration\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-link-invalid%20folder-829c33d0-f8e4-4456-b484-afdc8a7f66b3.jpg\" alt=\"1562-link-invalid%20folder-829c33d0-f8e4\" \/><\/p>\n<p class=\"caption\">Figure 10: For Subversion the repository URL must really specify the repository, not just the server upon which it resides.<\/p>\n<p>Once you supply a URL that correctly points into your Subversion repository (in my example, http:\/\/aragorn\/svn\/test-repo1), selecting <strong>Browse<\/strong> then opens a dialog to allow you to select a specific node in your repository source tree (Figure 11, background).<\/p>\n<p class=\"illustration\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-repobrowser%20create%20folder-f0823d28-6067-43bf-bad0-5e93defafd13.jpg\" alt=\"1562-repobrowser%20create%20folder-f0823\" \/><\/p>\n<p class=\"caption\">Figure 11: Select an existing folder or opt to add a new folder for maintaining your database objects in source control.<\/p>\n<p>Typically you will want to drill down under the trunk node to an appropriate location. Unless you have already done so in advance, you should then create a dedicated subfolder for the database so use the <strong>Create Folder<\/strong><strong>&#8230;<\/strong> button to open the create folder dialog (mid-ground), specify a folder name, and select Create. That opens just one final dialog (foreground) asking for a commit comment. You are actually operating in repository-space rather than filesystem space here (equivalent to operating in TortoiseSVN&#8217;s repo-browser). That is, the folder being created is in the repository itself. Every action in the repository creates a new revision, and every revision should have an associated comment so that when you or another member of your team later review the commit log you can have some idea as to why each and every change was committed to the repository.<\/p>\n<p>The other choices in Figure 9 follow analogous steps to associate your source control system of choice with your database. The team at Red Gate realized that this is a big step that you might approach warily at first. They therefore offer one more choice in Figure 9 to let you &#8220;have you cake and eat it too&#8221;. If you select <strong>Just Evaluating<\/strong>, you can try out SQL Source Control by connecting your database to an isolated, sandbox source control system (Figure 12). As the figure shows, this choice is useful if either you do not yet have a source control system, or you prefer not to connect to it until you have made the decision to go ahead with SQL Source Control <em>after<\/em> you have evaluated it.<\/p>\n<p class=\"illustration\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-link%20dialog%20w%20evaluation-21e8d6f8-b8d1-4500-b544-054a539a7bb0.jpg\" alt=\"1562-link%20dialog%20w%20evaluation-21e8\" \/><\/p>\n<p class=\"caption\">Figure 12 You can leave your source control system untouched unless and until you decide to go ahead with SQL Source Control with the handy evaluation option in the link setup dialog.<\/p>\n<h3 id=\"examining\">Examining Your New World<\/h3>\n<p>Once you have connected your database to your source control system, your world within SSMS will change subtlely. If you look at the object explorer in SSMS, you now have icon overlays indicating objects that have changed with respect to the source control repository (Figure 13).<\/p>\n<p class=\"illustration\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-changed%20files%20in%20object%20explorer-8f69b30a-33da-4f14-a4ca-7dbb2dbddc9f.jpg\" alt=\"1562-changed%20files%20in%20object%20exp\" \/><\/p>\n<p class=\"caption\">Figure 13 The object explorer in SSMS shows a change marker on each object (left) upon initial linkage, indicating they need to be committed to the source control repository. After commit, the change markers vanish (right).<\/p>\n<p>At this initial stage, <em>every<\/em> object in the database shows a change indicator because you have linked the database but have not yet committed anything to it.<\/p>\n<div class=\"note\">\n<p class=\"note\">Note that the change indicators are likely different from those you see from your other source control clients, e.g. TortoiseSVN. SQL Source Control supports many flavors of source control systems and for simplicity they chose to use a single set of icons independent of the source control system you are using.<\/p>\n<\/div>\n<p>Once you have linked your database to source control and committed it, you now also have access to your source-controlled database directly from your file system. Figure 14 illustrates using TortoiseSVN to checkout your database just as you would any other source code. Open the context menu on an empty folder (top pane) and select <strong>Checkout<\/strong>. In the Checkout dialog, specify the folder within the repository where you stored your database from SSMS (middle pane). Proceed with the checkout and you will see all the objects in your database in script form (bottom pane). You can then, if you so choose, work on database modifications from the file system: edit a script file, commit it to the database, then within SSMS you perform the canonical <strong>Update<\/strong> action (called Get Latest by SQL Source Control) to realize the changes you made in source control into your actual database.<\/p>\n<p class=\"illustration\"><img decoding=\"async\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/imported\/1562-tortoiseSVN%20checkout-749e7689-e3ae-41fe-8d27-c1e595326307.jpg\" alt=\"1562-tortoiseSVN%20checkout-749e7689-e3a\" \/><\/p>\n<p class=\"caption\">Figure 14 Once your database is in source control you can access it not just from SSMS but also from the file system. Here TortoiseSVN is used to checkout the database files; several tables are visible in the checkout log.<\/p>\n<p>That concludes part 1, covering the basic logistics to let you try out SQL Source Control. In the next part, we&#8217;ll demonstrate how to do the fundamental commit and update actions in SQL Source Control and then quickly move to the practicalities of rolling back a database to a previous revision, one of the major benefits of source control taken for granted with &#8220;regular&#8221; code. We&#8217;ll also show how to deploy a database from source control, including the important use of migration scripts provided by SQL Compare.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>It makes a lot of sense to do it, but how do you get started? Whatever you use to build Applications with SQL Server, there is a good way of using source control and many reasons for doing so.&hellip;<\/p>\n","protected":false},"author":221868,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[143532],"tags":[4242,4168,5716,5717,4179,4150,5631,4151,5260,4213,5500],"coauthors":[6802],"class_list":["post-1405","post","type-post","status-publish","format-standard","hentry","category-tools-sql-server","tag-basics","tag-database","tag-hg","tag-mercurial","tag-source-control","tag-sql","tag-sql-connect","tag-sql-server","tag-sql-source-control","tag-sql-tools","tag-tortoisesvn"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/1405","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/users\/221868"}],"replies":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/comments?post=1405"}],"version-history":[{"count":10,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/1405\/revisions"}],"predecessor-version":[{"id":78577,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/1405\/revisions\/78577"}],"wp:attachment":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media?parent=1405"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/categories?post=1405"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/tags?post=1405"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/coauthors?post=1405"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}