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)), 

, , , , , , ,

  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.

  2. #2 by bodybuilding on 05/10/2014 - 21:14

    Heya terrific website! Does running a blog like this require a lot
    of work? I’ve no understanding of computer programming however I had been hoping to start my own blog in the near future.
    Anyway, should you have any suggestions or techniques for
    new blog owners please share. I know this is off topic nevertheless I just needed to ask.

    • #3 by sveroadev on 10/10/2014 - 19:03

      Just write post on interesting topics, use sensible categories and tags…my few couple of tips

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

%d bloggers like this: