Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Add SQL Objects to TFS/ Version Control


Add SQL Objects to TFS/ Version Control

Author
Message
Vishal Sinha
Vishal Sinha
Mr or Mrs. 500
Mr or Mrs. 500 (552 reputation)Mr or Mrs. 500 (552 reputation)Mr or Mrs. 500 (552 reputation)Mr or Mrs. 500 (552 reputation)Mr or Mrs. 500 (552 reputation)Mr or Mrs. 500 (552 reputation)Mr or Mrs. 500 (552 reputation)Mr or Mrs. 500 (552 reputation)

Group: General Forum Members
Points: 552 Visits: 253
I work for a small company and we are trying to get all database objects in to TFS. Our dot net code is already in TFS but SQL objects code still not in source safe.

We use TFS 2005 and Visual Studio 2005 and SQL 2008.

Currently we only add SQL objects to TFS if we make changes to it recently. What we are trying to do is add all objects in to TFS one time and then manage it from within TFS - this will give us a history of all changes and also help us version the scripts.

One issue though - we need to maintain different versions of the code since some of our customers are in different versions. Like our latest build is 7.3.0 but some customers are in 7.0.0. and some are in 6.x.x etc.

So every time we start a new build effort, we branch the code and start developing in the version.

How will the SQL objects be managed if we are to create a branch and yet maintain history of changes?

Are we trying to accomplish too much? Would you have any ideas on to do this (add SQL objects to TFS and Source Control at the very least)?



smh-223044
smh-223044
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 Visits: 58
Have you looked into using Red Gate's SQL Source Control, http://www.red-gate.com/products/sql_source_control/index.htm. It allows you to source control your db schema objects in TFS direclty from SQL Server Management Studio.
HoneyShyam
HoneyShyam
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 46
This is not a solution.
I hope it should be inbuilt functionality into TFS 2010.
Thanks
Regards
Shyam
dmbaker
dmbaker
Mr or Mrs. 500
Mr or Mrs. 500 (575 reputation)Mr or Mrs. 500 (575 reputation)Mr or Mrs. 500 (575 reputation)Mr or Mrs. 500 (575 reputation)Mr or Mrs. 500 (575 reputation)Mr or Mrs. 500 (575 reputation)Mr or Mrs. 500 (575 reputation)Mr or Mrs. 500 (575 reputation)

Group: General Forum Members
Points: 575 Visits: 3441
Any chance you can upgrade to Visual Studio 2010 or later? SQL Server Data Tools, which is available in 2010/2012 is pretty darn useful, and it makes database development much easier. May not be an option in your case, but it might be worth looking into.

What I've done with past versions of Visual Studio is to script out objects from the database (which can easily be done with SQL Server Management Studio) and then I stuff them into a database project in VS. And from that point on, any database work I'd do in SQL Server Management Studio and just use the Visual Studio database project as a "dumb" repository to keep TFS in synch with my work. With SQL Server Data Tools though, I've moved my development over to Visual Studio almost entirely. Integration with TFS works well, and I'm able to develop and deploy changes without having to go back and forth between VS and SQL Server Management Studio.

As far as branching your code, it seems like you're doing it right if you need to start a revision for a particular customer. I think what you are missing is what you do with the branch once you are done with it and how to deliver the updates to the customer. Your branch needs to be merged back into the code that you branched from (back to the "trunk", the "trunk" being the baseline of code that you branched from). But then, if you have multiple customers on different versions, you may actually have a set of baseline "trunk" code lines that you have to manage, one per customer. But the basic idea is that you branch code from a trunk baseline, make your changes to the branch and once it's tested and ready, merge that branch back to the trunk and then deliver the code to the customer as a "release" (and the the "release" can just be a branch from the newly updated trunk).

Anyway, this is just one way to manage your version control system, it's what we use where we work but it may not be appropriate for you. Hopefully gives you some ideas though.



HoneyShyam
HoneyShyam
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 46
Thanks,
However I am trying to add Sql server database into TFS using VS 2012.
I hope this should work.

Can you please list out some steps to add Sql Database project into TFS using VS 2012
Thanks again.
Regards
Shyam Raghuvanshi
dmbaker
dmbaker
Mr or Mrs. 500
Mr or Mrs. 500 (575 reputation)Mr or Mrs. 500 (575 reputation)Mr or Mrs. 500 (575 reputation)Mr or Mrs. 500 (575 reputation)Mr or Mrs. 500 (575 reputation)Mr or Mrs. 500 (575 reputation)Mr or Mrs. 500 (575 reputation)Mr or Mrs. 500 (575 reputation)

Group: General Forum Members
Points: 575 Visits: 3441
Well, we don't use VS 2012 yet and I've not tried this with VS 2012, but I'll give it a shot.

1) Get Sql Server Data Tools! Download and install the appropriate version for you, there's one for VS 2012.

http://msdn.microsoft.com/en-us/data/hh297027

2) Create a new database project (make sure it's the SQL Server Data Tools project though, and not the default Visual Studio database project)

3) Reverse-engineer your database into your project. I use the "Schema compare" feature to do that, but I don't think that's the only way.

4) Add your project to TFS

That's basically it. Once you have the project in Visual Studio and have added it to TFS, you're pretty-much good to go.

You'll need to do your own research on how to use SQL Server Data tools, there's a lot to it and I can't possibly explain it all, especially since I don't use all of its functionality. There's plenty out on the internet to show you how to do that, though. Here's a link to a Tech-ed presentation on it:

http://channel9.msdn.com/Events/TechEd/NorthAmerica/2011/DEV207

But google for SSDT or "SQL Server Data Tools" and you'll find lots of info.



pzg5
pzg5
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 0
If you have VS 2012 installed. You must install SSDT 2012 on the same box. Then when you create new project you will see the DATABASE project template. After you create a new database project then you extract all SQL objects from the SQL Server. :-)
Hope this help!
----- Zack
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search