TFS compare command line

MikeMMikeM Posts: 6 New member
I see in the SQL Compare UI, you can easily compare a local db to a tfs db in source control. The XML shows it nicely and it works exactly as i want....but I cannot figure out how to do that in the command line.
Version:13.8.0.12703 pro

SourceControlFolder>$/company/Databases/dbname</SourceControlFolder>
-ScriptFolderDescription-$/companyname/Databases/dbname on https://companyname.visualstudio.com/

how do I translate that to command line using the switches available?
Tagged:

Answers

  • You need to have SQL Source Control installed on the same system where you are running the command.
    The example below should work

    sqlcompare.exe /s1:LiveSQLServer /db1:LocalDB /SourceControl2 /Revision2:HEAD /ScriptsFolderXML:xml.xml
    You can get the text needed to create xml.xml from SQL Source Control (more specifically on the Under the Hood section in the Setup tab for the SQL Source Control database) 

    https://documentation.red-gate.com/sc/using-the-command-line/switches-used-in-the-command-line#Switchesusedinthecommandline-/ScriptsFolderXML:%3Cfilepath%3E
    Sergio
    Product Support Engineer
    Redgate Software Ltd
    Please see our Help Center for detailed guides on how to use our tools
  • Alternatively, you could also checkout the version you want to compare using tf.exe (or corresponding tool for other Version Control Systems) and do a database to Scripts Folder comparison, in this case you would need the /Scripts2 switch only (instead of /SourceControl2, /Revision2 and /ScriptsFolderXML).
    Sergio
    Product Support Engineer
    Redgate Software Ltd
    Please see our Help Center for detailed guides on how to use our tools
  • MikeMMikeM Posts: 6 New member
    Thanks for the response.
    I see the option in the UI to connect to a remote tfs, but it just is not available for command line...? 

    I am trying to automate a report to show the differences between prod/dev and prod/tfs. The trick is that we have single-tenant databases and lots of clients. I have the first part working through tsql creating the bat file with the appropriate commands, run the bat to create output, which then are read through a second sproc to give me a meaningful output.
    If I could do the same thing with tfs/prod...then I'd be set.

    I think downloading the latest version will work, I will try that one out this week.

    Thanks again!

  • MikeMMikeM Posts: 6 New member
    More questions...
    I got the /Scripts1 switch working (thanks!), but I can't figure out how to identify which directory is for which database. The names are obfuscated and I can't find a mapping anywhere. Is that available for me to use?
  • MikeMMikeM Posts: 6 New member
    I found it. LinkedDatabases.xml
Sign In or Register to comment.