Options

Add Database to TFS by Script

seems like this would have been asked/answered but I wasn't able to find. Perhaps due to my not searching w/proper keywords
MSSQL w/TFS only
create table #dblist(ID int identity(1,1),dbName varchar(500)null,Cmd varchar(max))
insert #dbList select 'mydbname'=dbName
union insert #dbList select 'otherdbname1'
union insert #dbList select 'otherdbname2'
union insert #dbList select 'otherdbname3'...
declare @dbName varchar(500)='',@cmd varchar(max)
while @dbName is not null begin
update #dbList
 set Cmd='....bla bla some code to add each db to the local TFS....'
end 

then share this script w/team so all db's are added by/for each user?
Tagged:

Answers

  • Options
    Eddie DEddie D Posts: 1,781 Rose Gold 5
    Hi, Thank you for your forum post.

    I am confident what you are seeking is not possible within SQL Source Control.
    As a plug-in to SSMS, the database you wish to link to SQL Source Control must exist on the SQL Instance prior to it being linked to source control.

    This help document, explains the process for configuring a team to use the dedicated model, where each team member works on their own separate copy of the database.

    Many Thanks
    Eddie
    Eddie Davis
    Senior Product Support Engineer
    Redgate Software Ltd
    Email: support@red-gate.com
  • Options
    JeffPAHFJeffPAHF Posts: 3 New member
    each db exists w/in the instance where SQL Source Control (SQLSC) was added, currently one server in a farm of many. AND I don't think we want everyone in their Own copy of the databases, most of the db (not all) are production and Most changes (not all) are report or UI focused.

    The simple objective would be to save folks from having to manually add each of 20 to 50 dbs one-at-a-time in the SQLSC interface; this is our first roll-out and if we're going to add more and other SQL dev departments, setup/config should be as painless and foolproof as possible.
  • Options
    Eddie DEddie D Posts: 1,781 Rose Gold 5
    Hi, thank you for your reply.

    Slightly confused, as SQL Source Control is a plug-in to SSMS and is not installed at the instance level.  So each individual requires an installation of SQL Source Control on their machine

    From your description in your reply, it appears that you are using the 'Shared development model' where all developers work on a single copy of the database.  Further reading is available here.

    Many Thanks
    Eddie
    Eddie Davis
    Senior Product Support Engineer
    Redgate Software Ltd
    Email: support@red-gate.com
  • Options
    JeffPAHFJeffPAHF Posts: 3 New member
    Yikes, I'm very miss-understood... I'll cut to the chase... 

    I WAS seeking, now just giving up; a script with while loop for each named database and add them to the TFS to avoid having to force user/developer to add each-database-one-at-a-time (EDOaaT); and avoid the chance that someone would Not add a database due to oversight or nefarious motivations, instead a script that users (new users too) would run and it would add each db that the admin (not dba, but manager of programmers) would determine need to be added to TFS, in other words, updating the TFS database directly rather than using the GUI EDOAAT.

    cheers & peace out...
Sign In or Register to comment.