Posted By

michanne on 06/09/11


Tagged

TFS


Versions (?)

TFS Database Queries


 / Published in: SQL
 

Sometimes it is just more convenient to query the db. Returns Pending changes with local path. Have not investigated what lock status translates to.

  1. USE TfsVersionControl
  2.  
  3. SELECT DISTINCT
  4. DisplayName AS userName ,wksp.WorkspaceName,wksp.LastAccessDate,
  5. pc.TargetChildItem AS Item, pc.TargetParentPath AS tfspath,
  6. REPLACE(lv.LocalItem,'>','') AS localFile,
  7. LOCK.LockType,LOCK.LockStatus,
  8. pc.PendingChangeId,pc.PendingCommand,pc.VersionFrom
  9. FROM tbl_identity AS u
  10. JOIN dbo.tbl_Workspace wksp ON u.Identityid = wksp.OwnerId
  11. JOIN dbo.tbl_PendingChange pc ON pc.WorkspaceId = wksp.WorkspaceId
  12. JOIN dbo.tbl_Lock LOCK ON LOCK.LockStatus = pc.LockStatus
  13. JOIN dbo.tbl_LocalVersion lv ON pc.ItemId = lv.ItemId
  14. AND wksp.WorkspaceId = lv.WorkspaceId
  15.  
  16. WHERE wksp.WorkspaceName = 'Myworkspace'

Report this snippet  

You need to login to post a comment.