Sql-server – TFS Listing of all files and version numbers with a particular changeset

sql servertfstsql

I'm new to TFS and needing to write a TSQL query to get a listing of all files and version numbers that were included in a particular changeset version number. While searching online for the tables to get this information I found some people mentioning to use the Tfs_Warehouse database and others that used the Tfs_DefaultCollection database. I have the following questions:

  • What is the difference between the two databases?
  • Why would you use one instead of the other?
  • Which tables do you use to obtain the file/version information for a particular changeset?

Best Answer

If you're looking to get this data from the SQL Server database, here is a query to get you started:

SELECT 
    chg_set.CreationDate,
    chg_set.ChangeSetId, 
    v.FullPath
FROM dbo.tbl_ChangeSet (nolock)AS chg_set 
    INNER JOIN dbo.tbl_Version (nolock)AS v ON chg_set.ChangeSetId = v.VersionFrom 
    LEFT OUTER JOIN dbo.tbl_File (nolock) AS f ON v.FileId = f.FileId
WHERE (chg_set.ChangeSetId = [Your changeset ID])
ORDER BY chg_set.CreationDate, v.FullPath

Source: http://taoffi.isosoft.org/post/2012/05/23/TFS-database-pause-Change-set-quantitative-statistics-sample

Related Topic