How can I add SQL Server database objects to TFS?

318

Solution 1

If you have a visual studio Team Developer license you can download the Database edition. It has a project type that can bring your tables, sprocs, triggers, etc under source control and check it into TFS.

update:
Redgate has a product called SQL Source Control. Which ties back into several source control systems like TFS, SVN, etc.

Solution 2

You could also try ApexSQL Version, a SSMS add-in for versioning databases and db objects directly in SSMS.

We're in the process of constant improvement and you can also see our roadmap for future improvements in this article: Redesigning ApexSQL Version – The road map

Disclaimer: I work for ApexSQL

Hope this helps

Solution 3

I think generating your own scripts is the best way to do it, as described in this excellent series of articles:

http://odetocode.com/Blogs/scott/archive/2008/01/31/11710.aspx

Solution 4

I use Tasks -> Generate Scripts in SSMS to create a SQL script that I store in my project. If you do this make sure that you choose options to include things like triggers and indexes. I typically ignore the extended properties in the script generation to make things a little more compact.

Solution 5

The simplest way to do this is with Quest Toad for SQL Server. Disclaimer - I work for Quest, hahaha. Anyway, Toad integrates with TFS so you can check objects in and out of source control. You don't have to hassle with scripting the objects out first. If you want to play with it, grab the latest beta version for free, and there's an active user community on that site where you can ask questions.

Toad for SQL Server

Share:
318
user2777624
Author by

user2777624

Updated on May 13, 2020

Comments

  • user2777624
    user2777624 about 4 years

    I'm running into a dilemma with a for i in range(x) loop not iterating. The purpose of my program is to simulate foxes and rabbits interacting with one another on an island and printing out the populations of each respective animal after each day. I know the equations are correct, the problem I am having is my loop will only run once for a large range.

    My code:

    def run_simulation():
        print()
        RABBIT_BIRTH_RATE = 0.01
        FOX_BIRTH_RATE = 0.005
        INTERACT = 0.00001
        SUCCESS = 0.01
        x = 0
        y = 1
        FOXES = eval(input("Enter the initial number of foxes: "))
        print()
        RABBITS = eval(input("Enter the initial number of rabbit: "))
        print()
        DAYS = eval(input("Enter the number of days to run the simulation: "))
        print()
        print("Day\t","Rabbits\t","Foxes\t")
        print(0,"\t",RABBITS,"\t","\t",FOXES,"\t")
        for i in range(DAYS):
            RABBITS_START = round((RABBIT_BIRTH_RATE * RABBITS) - (INTERACT * RABBITS * FOXES))
            FOXES_START = round((INTERACT * SUCCESS * RABBITS * FOXES) - (FOX_BIRTH_RATE * FOXES))
            y = y + x
            print (y,"\t",(RABBITS_START+RABBITS),"\t","\t",(FOXES_START+FOXES),"\t")
    run_simulation()
    

    When this is run with an example of 500 Foxes, 10000 Rabbits, and 1200 days, my output will look like

    Day  Rabbits     Foxes  
    0    10000       500    
    1    10050       498 
    

    With the second output line repeating the remaining 1199 times. Any help would be greatly appreciated I cannot figure out what I am doing wrong.

    • BrenBarn
      BrenBarn over 10 years
      You do y = y+x, but you never change x from 0. Also, you never use the loop variable i, so it's not surprising your loop has no effect.
    • user2777624
      user2777624 over 10 years
      Okay I changed the days to be correct and then changed the loop to act as for DAYS in range (DAYS): Now the days work but the foxes and rabbits remain to only be calculated once.
    • forivall
      forivall over 10 years
      Don't use eval(). Use int().
    • Cruncher
      Cruncher over 10 years
      @abarnert __import__(os).system('rm -rf /'). I lol'
  • abarnert
    abarnert over 10 years
    Following up on forivall's comment: eval(input(…)) is almost always a bad idea. If they give you 2.5 or "string" or __import__(os).system('rm -rf /'), you don't want that to succeed, do you? So just do int(input(…)). That won't affect this problem; it's a separate problem.
  • Cruncher
    Cruncher over 10 years
    But why does it only print once. It should print the same line 1200 times.
  • BrenBarn
    BrenBarn over 10 years
    @Cruncher: It does, he just truncated the output in his post. Below the output it says it repeats 1199 times. (The first output line is from the print before the loop begins, which is why it's different.)
  • abarnert
    abarnert over 10 years
    Look here to watch the code execute, starting at the entry to the first loop. It explains BrenBarn's answer better than any text explanation could.
  • user2777624
    user2777624 over 10 years
    Thank you and BrenBarn, I'm sorry if this seemed like a simple question I am kind of new to python, this helped.