<p>I'm looking for some "Best Practices" for automating the deployment of Stored Procedures/Views/Functions/Table changes from source control. I'm using StarTeam &amp; ANT so the labeling is taken care of; what I am looking for is how some of you have approached automating the pull of these objects from source - not necessarily StarTeam.</p>

<p>I'd like to end up with one script that can then be executed, checked in, and labeled.</p>

<p>I'm NOT asking for anyone to write that - just some ideas or approaches that have (or haven't) worked in the past.</p>

<p>I'm trying to clean up a mess and want to make sure I get this as close to "right" as I can.</p>

<p>We are storing the tables/views/functions etc. in individual files in StarTeam and our DB is SQL 2K5.</p>

[{'answer_id': 52643, 'author': 'Peter', 'author_id': 5189, 'author_profile': 'https://Stackoverflow.com/users/5189', 'pm_score': 1, 'selected': False, 'text': '<p>I prefer to separate views, procedures, and triggers (objects that can be re-created at will) from tables.  For views, procedures, and triggers, just write a job that will check them out and re-create the latest.</p>\n\n<p>For tables, I prefer to have a database version table with one row.  Use that table to determine what new updates have not been applied.  Then each update is applied and the version number is updated.  If an update fails, you have only that update to check and you can re-run know that the earlier updates will not happen again.</p>\n'}, {'answer_id': 52677, 'author': 'Carl', 'author_id': 5449, 'author_profile': 'https://Stackoverflow.com/users/5449', 'pm_score': 3, 'selected': True, 'text': '<p>We use SQL Compare from redgate (<a href="http://www.red-gate.com/" rel="nofollow noreferrer">http://www.red-gate.com/</a>).</p>\n\n<p>We have a production database, a development database and each developer has their own database.</p>\n\n<p>The development database is synchronised with the changes a developer has made to their database when they check in their changes. </p>\n\n<p>The developer also checks in a synchronisation script and a comparison report generated by SQL Compare.</p>\n\n<p>When we deploy our application we simply synchronise the development database with the production database using SQL Compare.</p>\n\n<p>This works for us because our application is for in-house use only. If this isn\'t your scenario then I would look at SQL Packager (also from redgate).</p>\n'}]
['https://Stackoverflow.com/questions/52626', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']