Source Control in SQL Server

  • Oh - I didn't understand your question under that light at all.

    It's customary everywhere I've worked to maintain a single project per database, and to tag work items to specific SQL objects being updated.

    In your case, both developers would share the project, and would therefore be aware of each other's check-outs. If a conflict should appear, it would have to be resolved at check-in time. I don't think VSS was very good at identifying conflicts, so you'd usually want to run a comparison against the checked-in version before checking an object back in (in case someone checked it out and modified it before you get to it), OR implement an exclusive lock scenario.

    In this case you might end up with separate projects for your App and your data, but it's the only way I know to do it. Work item tracking with the right SDLC helper app is pretty good at keeping track of related checkins under multiple projects.

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • OK, perfect. That helps tremendously. A few more questions on how to accomplish this, as you can probably guess by now we have NO source control on our SQL Servers at all at this point and something that I deperately want to change:

    1. When creating the project for an existing DB that has many tables, views, sps, triggers, etc is there an easy way to create all of these script files other than scripting each one individually?

    2. Can you give me a sample of what a project would look like?

    (i.e. Tables

    CUSTOMER

    CONTACT

    etc

    SPs

    add_customer

    add_contact

    etc)

    3. Is there a way to label what scripts go together? For example, when working on a development project and I am modifying 2 table scripts and 2 sp scripts is there an easy way to show that these were changed for this one specific development project?

    Thanks for all of your input! Your thoughts are extremely helpful to me and I hope will better organize our development efforts moving forward!:D

  • In addition to Steve's article on how to handle VSS integration - you can script the objects using SQL Server 2005's "Generate Scripts" option. If you look at the options - you can get it to generate separate script files per object, and you can regulate how much detail you want added to each of the objects (extended properties, permissions, etc....)

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • aber (1/2/2009)


    3. Is there a way to label what scripts go together? For example, when working on a development project and I am modifying 2 table scripts and 2 sp scripts is there an easy way to show that these were changed for this one specific development project?

    When you check in the changed files to source control, you might consider checking in all related files together and use the same check-in comment, which provides some sort of common label.

    Don't forget that you can periodically use tagging/labelling that exists with all decent source control systems. This is especially useful as you can define a version of your schema objects that you can later retrieve in one go.

    David

  • We use a ticketing system to both assign problems and track code. Ticket number in the file name or a folder name works wonders. Each object is stored separately in the form of schema.objectname.objtype.

    Really helps if you do "change controls"... 😉

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • You can sort files if you install an add-on to the "SQL Server Management Studio" :

    http://www.sqldbatips.com/showarticle.asp?ID=78

    I use this tool and works!.

    Reggards, Emiliano.;-)

Viewing 7 posts - 16 through 21 (of 21 total)

You must be logged in to reply to this topic. Login to reply