我找到了tbl_Identity表!
在我們公司,我們有兩個TFS集合 - 讓我們稱之爲FooBar和FooBar-DSG--帶有兩個對應的數據庫:Tfs_FooBar和Tfs_FooBar-DSG。
[tbl_Identity]表位於名爲Tfs_Foobar_Configuration的數據庫中。
查找記錄在[tbl_Identity表,你將不得不加入[tbl_ChangeSet] [OWNERID]對[tbl_IdentityMap] [LOCALID],然後用[tbl_IdentityMap] [masterId]加入[tbl_Identity。 Id
下面是我最終做的事情 - 不是生成團隊列表,而是生成具有他們的電子郵件地址和最新簽入日期的用戶列表。我可以使用此列表將我的TFS停機時間通知電子郵件發送至。
這裏是我的查詢:
SELECT DISTINCT [OwnerId], I.DisplayName, I.MailAddress,
(SELECT TOP 1 CreationDate FROM [Tfs_FooBar-DSG].[dbo].tbl_ChangeSet C2
WHERE C2.OwnerId = C1.OwnerId ORDER BY CreationDate DESC) LatestDate
FROM [Tfs_FooBar-DSG].[dbo].[tbl_ChangeSet] C1
LEFT OUTER JOIN [Tfs_FooBar-DSG].[dbo].[tbl_IdentityMap] IM ON IM.[localId] = C1.OwnerId
LEFT OUTER JOIN Tfs_FooBar_Configuration.[dbo].[tbl_Identity] I ON IM.[masterId] = I.Id
ORDER By LatestDate DESC, [OwnerId], DisplayName, MailAddress
SELECT DISTINCT [OwnerId], I.DisplayName, I.MailAddress,
(SELECT TOP 1 CreationDate FROM [Tfs_FooBar].[dbo].tbl_ChangeSet C2
WHERE C2.OwnerId = C1.OwnerId ORDER BY CreationDate DESC) LatestDate
FROM [Tfs_FooBar].[dbo].[tbl_ChangeSet] C1
LEFT OUTER JOIN [Tfs_FooBar].[dbo].[tbl_IdentityMap] IM ON IM.[localId] = C1.OwnerId
LEFT OUTER JOIN Tfs_FooBar_Configuration.[dbo].[tbl_Identity] I ON IM.[masterId] = I.Id
ORDER By LatestDate DESC, [OwnerId], DisplayName, MailAddress
更新:「你不應該直接寫查詢針對TFS操作店這是不受支持的和潛在的危險」丹尼爾·曼恩警告在下面,他的評論。自己決定是否可以忍受不受支持的功能,以及SELECT查詢的危險程度。
您不應直接針對TFS操作存儲區編寫查詢。它不受支持並具有潛在的危險性。 –