SQL Server 2005 version control - Only for experts

Well assuming that a 3 tiered architecture of a program written in non object oriented language like visual basic 6.0, it has user interface files, logical files that support functions or functionalities, we will have the final tier…the database tier where sometimes we have all our data stored, some stored procedures and functions, that also contribute to the logical tier.

So the question is: how do I make control version with TFS in Sql server 2005 database?

To those who didn’t understand what I mean, here is a more complete version of the problem:

Our company has a ERP software based on visual basic 6.0 and sql server 2005.

It’s a very large application, and we need to have control version in all development to reduce maintenance costs.

Our product is sold by components (financial component, administrative component, etc).

Each component has several files in asp code, code in the sql database (stored procedures, functions and reports) and finally we have database tables. To each component there are hundreds of asp files, stored procedures, functions, reports and database tables. The database installed in each client is huge.

We need to control the code written and that is assured by TFS (stored procedures, asps, functions and reports) but how in the world do I do control version in SQL Database with TFS? Is it possible?

[2122 byte] By [JonnyCool] at [2007-12-20]
# 1

Your database objects (stored procedures, functions, table definitions, etc) need to be stored in files. The easiest way to do this is with Visual Studio Database Projects.

Click File->New->Project. Choose "Other Project Types"->"Database"->"Database Project". Type in your server connection info.

Once the project has been created, use Server Explorer to connect to your database again. Highlight each database object (you can multi-select), right click, and choose "Generate Create Script To Project".

Once you've finished that exercise, you can bind the database project to version control just like you would an ordinary C# project. If you want to keep your database objects closer to your ASP files, create a project for each and put them in the same solution.

Justin Pinnix
SDE - Version Control Server

JustinPinnixMSFT at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Version Control...
# 2

Tnx that did the trick.

Is there any way to organize this so that i'll have stored procedures in a folder, functions and tables in another?

JonnyCool at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Version Control...
# 3

Any suggestions on how to do this when you have an existing database with a large # of objects.

For example, we have an existing database with 1000+ stored procedures. Right clicking on each individually and doing the create command is not going to be practical.

If there was a way to assign a function key to this so i could just move down the list and keep typing CTRL-L for example might work but going thru the menu to select the create script option is very slow.

RobertV at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Version Control...
# 4

The only thing I can think of would be to write some SQL code to extract the database objects into file system files.

You might want to check out the new "Visual Studio Team System for Database professionals" product. They've worked to improve the version control experience for database developers.

Brian

BrianHarry at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Version Control...
# 5
I found that if you connect to a SQL 2005 database under Server Explorer in VS 2005, you can drag and drop existing database objects into the Create Scripts folder in your database project. Upon dropping, either VS or SQL Server creates a script file named [db name].dbo.[object name].SQL that can be used to recreate the object. Interestingly enough, if you drag multiple objects, a corresponding script isn't created for each object rather one script is created that includes creation script for all of the drag-dropped objects.
welikeike at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Version Control...
# 6

That's the problem. It just lumps them. Tried holding Ctrl or Shift or both and it didn't do a thing. Not very friendly. So working on an existing DB with Team Foundation appears to be a non-starter.

There is another tool called "MSSCCI Provider". I was hoping I could use that from SQL Management Studio. Unfortunately, the support is limited to "use the forums". There is no example page such as, here is how you can get Pubs into Team Foundation. So even starting to figure it out is a pain.

Good luck

ACmct at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Version Control...

Visual Studio Team System

Site Classified