TFS – list files across team projects by SQL

When working with TFS you often need to list files from the source control. This can be done in many ways, but as a geek, I want a SQL script to list and search for files. Off course, I can use the TFS Power Tool and the “Find in source control…” function.

But here is a script for listing and searching for files accross team projects. The below example searches for all files with filename containing ‘ADSync’.

  ,SUBSTRING([FilePath], 1, 
        CHARINDEX('/', [FilePath], 3)) as TeamProject
FROM [Tfs_Warehouse].[dbo].[DimFile]
WHERE [FileName] LIKE '%ADSync%' 
  AND [FileExtension] LIKE '%';

The below statement will count number of aspx files across all team project.

  SUBSTRING([FilePath], 1, CHARINDEX('/', [FilePath], 3)), 
FROM [Tfs_Warehouse].[dbo].[DimFile]
WHERE FileExtension in ('.aspx')
   SUBSTRING([FilePath], 1, CHARINDEX('/', [FilePath], 3)), 
About these ads

, , , , , , ,

  1. #1 by Crystle on 22/05/2013 - 03:55

    I think the admin of this web site is really working hard in support of his site, because here every stuff is quality based material.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 719 other followers

%d bloggers like this: