我正在尝试为存储在 TFS_warehouse (TFS 2012) 中的故事构建 SQL 查询。我想要的是一个简单的故事列表,包括基本元素,如 ID、标题和描述。但是,我无法在仓库中找到描述 - 谁能告诉我存储它的列和表的名称?
问问题
640 次
2 回答
0
The actual tables are in the TFS_[Collection] database in the WorkItemsAre and WorkItemsLatest tables.
Where [Collection] is the name of the collection.
All the TFS_[Collection] databases are rolled up into the TFS_Warehouse database.
于 2013-06-14T01:49:21.867 回答
0
以下请求将为您提供所有 WorkItem 及其最后描述和最后评论:
select
WIL.ID,
WAO.[System.WorkItemType],
WIL.[Created Date],
WAO.[System.CreatedBy],
WAO.[System.AssignedTo],
WIL.[Changed Date],
WAO.[System.ChangedBy],
WAO.[System.State],
WAO.[System.Reason],
WAO.[System.Title],
(select top 1 left(REPLACE(REPLACE(replace(Words, ',', '\,'), CHAR(13), ' '), CHAR(10), ' '), 32000) from [dbo].[WorkItemLongTexts] where ID = WIL.ID and FldID = 52 order by AddedDate desc) [Description],
(select top 1 left(REPLACE(REPLACE(replace(Words, ',', '\,'), CHAR(13), ' '), CHAR(10), ' '), 32000) from [dbo].[WorkItemLongTexts] where ID = WIL.ID and FldID = 54 order by AddedDate desc) [LastComment]
from
[dbo].[WorkItemsLatest] WIL
inner join [dbo].[WorkItemsAsOf] WAO on WAO.[System.Id] = WIL.ID AND WAO.[System.Rev] = WIL.Rev
where
WAO.[System.TeamProject] = @ProjectName
order by
WIL.[Created Date] ASC
您必须在Tfs_XXXCollection
数据库上执行此操作。
要检查您的 FieldId 是否正确,只需执行
select * from fields where [name] in ('Description','History')
如果您愿意,您可以轻松获得完整的历史记录,但通常这足以让您继续前进。
于 2018-05-29T13:14:41.980 回答