I'm querying the TFS_Warehouse and TFS_DefaultCollection databases to look at changesets but I need to determine which branch the changeset is associated with. This isn't obvious to me looking at the data. Ideas?
-
Care to elaborate? – Abhisek Roy Mar 08 '18 at 16:35
-
Yes, sorry. I'm looking at tbl_ChangeSet. That has every changeset that happens in TFS, regardless of Branch. There's no ID that links that changeset to the branch that the changeset occurred in that I can see. That's what I need to figure out. – Terry Mar 08 '18 at 17:49
-
Hi Terry, any update on this? Did my reply help or give a right direction? – PatrickLu-MSFT Apr 02 '18 at 02:11
1 Answers
You can write queries against the TFS data warehouse or the TFS analysis cube. However, do not write queries directly against the project collection databases, it's not suggested and will lose support.
A changeset can of course contain files in multiple branches. There is not any table or query could indicate which branch a changeset is associated with.
The simplest way is through tracking changeset feature.
Detail steps please refer this question: Is there a way to find out the source changeset from which a particular branch was created in TFS?
If you insist on using SQL, you could first get all files and version numbers with a particular changeset, and then through all of the files get the related branch. Take a look at below thread which may be helpful:

- 49,478
- 5
- 35
- 62