[dba-SQLServer] Source Control

Arthur Fuller fuller.artful at gmail.com
Sat Jun 2 08:26:16 CDT 2007


Assuming that you have SQL 2005, then there are two approaches, the standard
old way and the fancy new way. Whether you can use the fancy new way depends
on the version of Visual Studio.NET you have installed. If you have the
standard version you cannot use the fancy new way.

The fancy new way goes something like this:

1. create a database project in VS.NET.
2.Open Solution Explorer.
3. Make sure that the database of interest is listed in the Database
References of the project. If it's not there, right-click Database
References and add it.
4. In Server Explorer, expand the Data Connections node and keep expanding
until you get to the Stored Procedures node.
5. Open the context men for a sproc and select Generate Script to Project.
This will add the script to the Create Scripts folder of the project.
6. Do the same thing with a table and a view and a UDF.
(You may not have to go through all this, depending on your version of
VS.NET. Check to see if you have the command Generate Create Script on the
context menu of the data connection. If you have that command available, you
can do all the objects in the database at once.)

Next step is to add the project and all its files to Visual Source Safe.
This is straightforward so I won't bother detailing it. VSS prompts you to
add a project. Do it. All your scripts will be added to the VSS project and
locked automatically. Then you can check out the one(s) of interest.

The traditional approach (when you do not have VS.NET) goes like this:
In Enterprise Manager or Management Studio, generate scripts for all your
objects.
In VSS, create a new project. Point to the directory into which you
generated all your scripts, and add them.
Check out the one(s) of interest.

hth,
Arthur


On 6/1/07, Robert L. Stewart <rl_stewart at highstream.net> wrote:
>
> Does anybody have a solution they are using
> for version control of source SQL statements;
> DDL, stored procedures, functions, etc?
>
> Robert
>
>
> _______________________________________________
> dba-SQLServer mailing list
> dba-SQLServer at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> http://www.databaseadvisors.com
>
>



More information about the dba-SQLServer mailing list