Find checkin comment info in TFS2010 Warehouse - tfs

Does anybody knows if the TFS 2010 Warehouse database (the one supposed to be used for reporting) keeps any information about the checkin comments for a changeset?
I can see the information via the TFS Explorer, like this
But if I try to extract the same information from the Warehouse database, also selecting every data from the changeset and code churn tables, I'm not able to find it (I've also tried to open every single database table!)
select * from FactWorkItemChangeset fwics
join DimChangeset dcs on fwics.ChangesetSK=dcs.ChangesetSK
where dcs.ChangesetID = 145640
Thanks in advance.
Regards
Massimo

The ChangeSet Title field in Tfs_Warehouse.dbo.DimChangeset has the comment, albeit concatenated with the change set number. Your query does return the field.

Sample query:
select
fwics.WorkItemID as [Work Item Id]
,dwi.System_Title as [Title]
,dwi.System_WorkItemType as [Type]
,dcs.ChangesetID as ChangeSet_ID
,dcs.ChangesetTitle as [Comment]
,df.FileName as [FileName]
,df.FilePath as [Path]
,dd.DateTime as [CheckinDate]
,dp.Name as [Person]
from
DimChangeset dcs
join FactWorkItemChangeset fwics on dcs.ChangesetSK=fwics.ChangesetSK
join FactCodeChurn fcc on fwics.ChangesetSK=fcc.ChangesetSK
join DimFile df on fcc.FilenameSK=df.FileSK
join CurrentWorkItemView dwi on dwi.System_Id=fwics.WorkItemID
join DimDate dd on dd.DateSK=fcc.DateSK
join DimPerson dp on dp.PersonSK=dcs.CheckedInBySK
and fcc.TeamProjectSK = 80
order by [CheckinDate] desc

Related

How to fix DF-JOIN-002 Error in Azure Data Factory (Only two Join conditions allowed)

I have a data flow with a Union on two tables then joining the results of the Union to another table. I keep receiving the following error when I try debugging the pipeline or previewing the data.
DF-JOIN-002 at Join 'Join1'(Line 40/Col 26): Only 2 join condition(s) allowed
I'm basically trying to build a pipeline to automate this query:
SELECT DISTINCT k.acct_id, s.Id, Email, FirstName, LastName FROM table_3 s
INNER JOIN
( (SELECT acct_id, event_date FROM table_1)
UNION (SELECT acct_id, event_date FROM table_2)) k
ON k.acct_id = s.Archtics_acct_id__c
WHERE event_date = 'xxxx-xx-xx'
enter image description here
I figured it out after some time. I had to delete the Join activity and add it again. It was still linked to another source. Even though only two sources were selected in the join settings

TFS 2012 Discussion Users

Where can I find in the TFS database the user that entered a discussion item as shown here? I've found where the discussion items are on the WorkItemLongTexts table, and I see where the user data is on the Constants table, but I see no table or view that ties the two together.
I finally figured out how the discussion/comments users and timestamps are stored in the TFS database. It's a dumb design. You have to UNION the WorkItemsWere and WorkItemsAre tables and JOIN to the WorkItemLongTexts. I explored the "Change Order" and "Rev" columns to make the JOIN, but made no sense of it. Rather, you have to JOIN by the DATETIMES. I wouldn't normally advocate joining like this, but it was the only way I could make it work. In the end I was able to extract all my data, complete my conversion and finally put TFS to bed.
Here's the query if you're interested...
WITH WorkItems AS (
SELECT ID, PersonId, [Changed Date]
FROM WorkItemsAre
UNION
SELECT ID, PersonId, [Changed Date]
FROM WorkItemsWere
), Discussion AS (
SELECT *
FROM WorkItemLongTexts
WHERE FldID = 54
)
SELECT w.ID, PersonId, NamePart, d.AddedDate, Words
FROM Discussion d
INNER JOIN WorkItems w
ON d.ID = w.ID
AND d.AddedDate = w.[Changed Date]
LEFT OUTER JOIN Constants c
ON w.PersonId = c.ConstID
ORDER BY w.ID, d.AddedDate

bigQuery - Join

I'm trying to join two databases on the ID. The first database on price quotes does not have the data on websites, so I want to join it in from the logs database. However, in the logs database the ID is not unique, but the first chronological appearance of the ID - this is the right website.
When I run the query below, I get:
Resources exceeded during query execution.
Hence I don't know whether the problem is the code or something else.
Thanks
SELECT ID, user,busWeek, count(*) as num FROM [datastore.quotes]
Join (
select objectID, first(website) from (
select objectID, website, date from [datastore.allLogs]
order by date) group by objectID)
as Logs
on ID = objectID
group by ID,user,busWeek
Can you try:
SELECT ID, user,busWeek, count(*) as num FROM [datastore.quotes]
Join EACH (
select objectID, first(website) from (
select objectID, website, date from [datastore.allLogs]
order by date) group EACH by objectID)
as Logs
on ID = objectID
group by ID,user,busWeek
Note the 'EACH' - that keyword won't be needed in the future, but it's still useful today.
I think the issue is in ORDER BY. This brings all calculation to one node which causes "Resources Exceeded" message. I understand you need it to bring first (by date) website for each object.
Try to rewrite this select (inside join) to be partitioned.
For example using window functions with OVER(PARTITION BY ... ORDER BY)
In this case, I think, you have chance to make this in parallel
See below for reference
Window Functions

In TFS 2010 how can I search for a value entered into the note during check-in?

We have a Team Project Collection Source Control Setting for Check-in Notes that requires each check-in to capture a "Tracking Number". This number is external to TFS. I need to search for all the changesets that have a specific Tracking number.
The resulting changeset list tells me what to get latest version on, for a monthly deployment.
We don't use Work Items.
Question 1) Where in tfs_default_collection are the notes stored? One way to easily look would be to query with .SQL. I don't see "Note" in any of the database schemas.
Question 2) If I can't use .SQL to search, what object reference in Microsoft.TeamFoundation.VersionControl.Client.dll will give me the details of the Check-in Notes?
If I know what the changeset number is, then I can do something like this to give me the list.
-- these are all the .slq objects checked in $Release on '2013-01-28'
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.CreationDate >= '2013-01-31'
and FullPath like '%Tracker\Releases\2013.02.31%'
and FullPath like '%.sql%'
ORDER BY chg_set.CreationDate, v.FullPath
After some more digging into TFS_DefaultCollection I found it.
I can join these results with the query above and see exactly what I am looking for.
SELECT ReleaseNoteId, FieldName, BaseValue
from Tfs_DefaultCollection.dbo.tbl_ReleaseNoteDetails
where ReleaseNoteId in (SELECT ReleaseNoteId
FROM Tfs_DefaultCollection.dbo.tbl_ReleaseNote
where DateCreated between '2013-01-18' and '2013-02-22')
and FieldName = 'Tracker #'
and BaseValue <> '0' -- base value of zero is a merge from $Main
Thank you, in advance.

using SQL aggregate functions with JOINs

I have two tables - tool_downloads and tool_configurations. I am trying to retrieve the most recent build date for each tool in my database. The layout of the DB is simple. One table called tool_downloads keeps track of when a tool is downloaded. Another table is called tool_configurations and stores the actual data about the tool. They are linked together by the tool_conf_id.
If I run the following query which omits dates, I get back 200 records.
SELECT DISTINCT a.tool_conf_id, b.tool_conf_id
FROM tool_downloads a
JOIN tool_configurations b
ON a.tool_conf_id = b.tool_conf_id
ORDER BY a.tool_conf_id
When I try to add in date information I get back hundreds of thousands of records! Here is the query that fails horribly.
SELECT DISTINCT a.tool_conf_id, max(a.configured_date) as config_date, b.configuration_name
FROM tool_downloads a
JOIN tool_configurations b
ON a.tool_conf_id = b.tool_conf_id
ORDER BY a.tool_conf_id
I know the problem has something to do with group-bys/aggregate data and joins. I can't really search google since I don't know the name of the problem I'm encountering. Any help would be appreciated.
Solution is:
SELECT b.tool_conf_id, b.configuration_name, max(a.configured_date) as config_date
FROM tool_downloads a
JOIN tool_configurations b
ON a.tool_conf_id = b.tool_conf_id
GROUP BY b.tool_conf_id, b.configuration_name

Resources