<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Tad Beaty</title>
        <link>http://geekswithblogs.net/tbeaty/Default.aspx</link>
        <description> </description>
        <language>en-US</language>
        <copyright>tbeaty</copyright>
        <managingEditor>tad.beaty@comcast.net</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <image>
            <title>Tad Beaty</title>
            <url>http://geekswithblogs.net/images/RSS2Image.gif</url>
            <link>http://geekswithblogs.net/tbeaty/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <item>
            <title>How to pull all Pending Changes (Checked Out Items) from TFS 2005 or 2008 using SSRS and SQL</title>
            <category>TFS</category>
            <category>SSRS</category>
            <category>SQL</category>
            <link>http://geekswithblogs.net/tbeaty/archive/2009/03/19/how-to-pull-all-pending-changes-checked-out-items-from.aspx</link>
            <description>After reading Tom Fischer's blog entry on &lt;a href="http://www.geekswithblogs.com/ftom/archive/2008/09/17/how-to-pull-all-pending-changes-checked-out-items-from.aspx"&gt;How to pull all Pending Changes (Checked Out Items) from TFS 2005 or 2008&lt;/a&gt; I thought I would look into how to accomplish the same objective using SSRS and SQL.&lt;br /&gt;
&lt;br /&gt;
With more research on the TfsVersionControl database and also reviewing a query on &lt;a href="http://www.lazydba.com/sql/1__56584.html"&gt;retrieving data from a TFS database&lt;/a&gt;, I put together this sql statement that retrieves a list of users who have items checked out.&lt;br /&gt;
&lt;pre&gt;&lt;span style="COLOR: #0000ff"&gt;&lt;span style="COLOR: #009900"&gt;/* This query returns the
    list of currently checked out items */&lt;/span&gt;
declare&lt;/span&gt; @UtcDiff &lt;span style="COLOR: #0000ff"&gt;int&lt;/span&gt;,@Date &lt;span style="COLOR: #0000ff"&gt;datetime&lt;/span&gt;
   ,@Offset &lt;span style="COLOR: #0000ff"&gt;int&lt;/span&gt;

&lt;span style="COLOR: #009900"&gt;--set the time difference, date, and number of dates back you want to go&lt;/span&gt;
&lt;span style="COLOR: #0000ff"&gt;select&lt;/span&gt; @UtcDiff=&lt;span style="COLOR: #ff00ff"&gt;datediff&lt;/span&gt;(millisecond,&lt;span style="COLOR: #ff00ff"&gt;getutcdate&lt;/span&gt;(), &lt;span style="COLOR: #ff00ff"&gt;getdate&lt;/span&gt;())
   ,@Date=&lt;span style="COLOR: #ff00ff"&gt;convert&lt;/span&gt;(&lt;span style="COLOR: #0000ff"&gt;datetime&lt;/span&gt;,&lt;span style="COLOR: #ff00ff"&gt;convert&lt;/span&gt;(&lt;span style="COLOR: #0000ff"&gt;varchar&lt;/span&gt;(20),&lt;span style="COLOR: #ff00ff"&gt;getdate&lt;/span&gt;(),101))
   ,@Offset=5

&lt;span style="COLOR: #0000ff"&gt;select&lt;/span&gt; i.displayname&lt;span style="COLOR: #0000ff"&gt; as &lt;/span&gt;UserID
   ,&lt;span style="COLOR: #ff00ff"&gt;replace&lt;/span&gt;(&lt;span style="COLOR: #ff00ff"&gt;replace&lt;/span&gt;(pc.TargetParentPath+&lt;span style="COLOR: #ff00ff"&gt;replace&lt;/span&gt;(pc.targetChildItem,&lt;span style="COLOR: #ff0000"&gt;'\'&lt;/span&gt;,&lt;span style="COLOR: #ff0000"&gt;''&lt;/span&gt;),&lt;span style="COLOR: #ff0000"&gt;'"'&lt;/span&gt;,&lt;span style="COLOR: #ff0000"&gt;'-'&lt;/span&gt;),&lt;span style="COLOR: #ff0000"&gt;'&amp;gt;'&lt;/span&gt;,&lt;span style="COLOR: #ff0000"&gt;'_'&lt;/span&gt;)&lt;span style="COLOR: #0000ff"&gt; as &lt;/span&gt;TFSFile
   ,pc.PendingCommand&lt;span style="COLOR: #0000ff"&gt; as &lt;/span&gt;CommandType
   ,&lt;span style="COLOR: #ff00ff"&gt;dateadd&lt;/span&gt;(millisecond,@UtcDiff,pc.CreationDate)&lt;span style="COLOR: #0000ff"&gt; as &lt;/span&gt;LocalTime
&lt;span style="COLOR: #0000ff"&gt;from&lt;/span&gt; dbo.tbl_PendingChange pc
&lt;span style="COLOR: #888888"&gt;inner join&lt;/span&gt; dbo.tbl_Workspace w&lt;span style="COLOR: #0000ff"&gt; on &lt;/span&gt;w.workspaceid=pc.workspaceid
&lt;span style="COLOR: #888888"&gt;inner join&lt;/span&gt; dbo.tbl_Identity i&lt;span style="COLOR: #0000ff"&gt; on &lt;/span&gt;w.ownerid=i.identityid
&lt;span style="COLOR: #0000ff"&gt;where&lt;/span&gt; pc.creationdate&lt;span style="COLOR: #888888"&gt;&amp;lt;=&lt;/span&gt;dateadd(&lt;span style="COLOR: #ff00ff"&gt;day&lt;/span&gt;,-&lt;span style="COLOR: #ff00ff"&gt;convert&lt;/span&gt;(&lt;span style="COLOR: #0000ff"&gt;int&lt;/span&gt;,@Offset),@Date)
   &lt;span style="COLOR: #888888"&gt;and&lt;/span&gt; w.computer &lt;span style="COLOR: #888888"&gt;is not null&lt;/span&gt;
&lt;span style="COLOR: #0000ff"&gt;order by&lt;/span&gt; i.displayname,pc.creationdate
&lt;/pre&gt;
&lt;br /&gt;
Please note the second to last line in the query "and w.computer is not null".  The tbl_PendingChange stores all checked out &lt;strong&gt;and&lt;/strong&gt; shelved items.  If you remove the "not" and add the tbl_workspace columns "WorkspaceName" and "Comment" (see query below) you can get a list of what items have been shelved and when.&lt;br /&gt;
&lt;pre&gt;&lt;span style="COLOR: #0000ff"&gt;&lt;span style="COLOR: #009900"&gt;/* This query returns the
    list of current shelf sets */&lt;/span&gt;
declare&lt;/span&gt; @UtcDiff &lt;span style="COLOR: #0000ff"&gt;int&lt;/span&gt;,@Date &lt;span style="COLOR: #0000ff"&gt;datetime&lt;/span&gt;
   ,@Offset &lt;span style="COLOR: #0000ff"&gt;int&lt;/span&gt;

&lt;span style="COLOR: #009900"&gt;--set the time difference, date, and number of dates back you want to go&lt;/span&gt;
&lt;span style="COLOR: #0000ff"&gt;select&lt;/span&gt; @UtcDiff=&lt;span style="COLOR: #ff00ff"&gt;datediff&lt;/span&gt;(millisecond,&lt;span style="COLOR: #ff00ff"&gt;getutcdate&lt;/span&gt;(), &lt;span style="COLOR: #ff00ff"&gt;getdate&lt;/span&gt;())
   ,@Date=&lt;span style="COLOR: #ff00ff"&gt;convert&lt;/span&gt;(&lt;span style="COLOR: #0000ff"&gt;datetime&lt;/span&gt;,&lt;span style="COLOR: #ff00ff"&gt;convert&lt;/span&gt;(&lt;span style="COLOR: #0000ff"&gt;varchar&lt;/span&gt;(20),&lt;span style="COLOR: #ff00ff"&gt;getdate&lt;/span&gt;(),101))
   ,@Offset=5

&lt;span style="COLOR: #0000ff"&gt;select&lt;/span&gt; i.displayname&lt;span style="COLOR: #0000ff"&gt; as &lt;/span&gt;UserID
   ,&lt;span style="COLOR: #ff00ff"&gt;replace&lt;/span&gt;(&lt;span style="COLOR: #ff00ff"&gt;replace&lt;/span&gt;(pc.TargetParentPath+&lt;span style="COLOR: #ff00ff"&gt;replace&lt;/span&gt;(pc.targetChildItem,&lt;span style="COLOR: #ff0000"&gt;'\'&lt;/span&gt;,&lt;span style="COLOR: #ff0000"&gt;''&lt;/span&gt;),&lt;span style="COLOR: #ff0000"&gt;'"'&lt;/span&gt;,&lt;span style="COLOR: #ff0000"&gt;'-'&lt;/span&gt;),&lt;span style="COLOR: #ff0000"&gt;'&amp;gt;'&lt;/span&gt;,&lt;span style="COLOR: #ff0000"&gt;'_'&lt;/span&gt;)&lt;span style="COLOR: #0000ff"&gt; as &lt;/span&gt;TFSFile
   ,pc.PendingCommand&lt;span style="COLOR: #0000ff"&gt; as &lt;/span&gt;CommandType
   ,&lt;span style="COLOR: #ff00ff"&gt;dateadd&lt;/span&gt;(millisecond,@UtcDiff,pc.CreationDate)&lt;span style="COLOR: #0000ff"&gt; as &lt;/span&gt;LocalTime
   ,w.WorkspaceName
   ,w.Comment
&lt;span style="COLOR: #0000ff"&gt;from&lt;/span&gt; dbo.tbl_PendingChange pc
&lt;span style="COLOR: #888888"&gt;inner join&lt;/span&gt; dbo.tbl_Workspace w&lt;span style="COLOR: #0000ff"&gt; on &lt;/span&gt;w.workspaceid=pc.workspaceid
&lt;span style="COLOR: #888888"&gt;inner join&lt;/span&gt; dbo.tbl_Identity i&lt;span style="COLOR: #0000ff"&gt; on &lt;/span&gt;w.ownerid=i.identityid
&lt;span style="COLOR: #0000ff"&gt;where&lt;/span&gt; pc.creationdate&lt;span style="COLOR: #888888"&gt;&amp;lt;=&lt;/span&gt;dateadd(&lt;span style="COLOR: #ff00ff"&gt;day&lt;/span&gt;,-&lt;span style="COLOR: #ff00ff"&gt;convert&lt;/span&gt;(&lt;span style="COLOR: #0000ff"&gt;int&lt;/span&gt;,@Offset),@Date)
   &lt;span style="COLOR: #888888"&gt;and&lt;/span&gt; w.computer &lt;span style="COLOR: #888888"&gt;is null&lt;/span&gt;
&lt;span style="COLOR: #0000ff"&gt;order by&lt;/span&gt; i.displayname,pc.creationdate
&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=130222"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=130222" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/tbeaty/aggbug/130222.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>tbeaty</dc:creator>
            <guid>http://geekswithblogs.net/tbeaty/archive/2009/03/19/how-to-pull-all-pending-changes-checked-out-items-from.aspx</guid>
            <pubDate>Thu, 19 Mar 2009 06:19:52 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/tbeaty/comments/130222.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/tbeaty/archive/2009/03/19/how-to-pull-all-pending-changes-checked-out-items-from.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/tbeaty/comments/commentRss/130222.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>