title: Managing Database Code Reviews in TFS
body: <p>I am currently faced with a situation where I am working in a TFS repository that has a large source control folder dedicated to the database.  There are sub folders for various database objects like tables, stored procedures, functions, etc.  Right now our team is expected to create a DB code review task each time we check in a database change against one of these objects.  Over the past couple months I have had somewhere between 40-50 check ins touching various database objects.  The problem is that this is not really efficient because a material percentage of these check ins and subsequent reviews become a waste of time because chronologically later check ins make that code obsolete.  I am just one dev on an 8-10 person team too, those poor DBA's!</p>
  
  <p>I have what I think would be a working solution but I don't think it's possible to get this data out of the UI (at least in TFS 2012) and I'm not sure how to even begin a query to get it (assuming they will even give me access to the tfs db).  </p>
  
  <p>What I would like to get is a result set including all modified files within a specific source control folder and sub folders between two dates.  I would then like to be able to get the id of the changeset that was in effect at the beginning date and the changeset id that was in effect at the end of that date.  </p>
  
  <p>The table would hopefully look something like this:</p>
  
  <p>File1 - BeginningChangesetID - EndingChangesetID</p>
  
  <p>File2 - BeginningChangesetID - EndingChangesetID</p>
  
  <p>This way we could structure our DB code reviews such that we can provide a file name, the beginning changeset and the ending changeset.  This would allow the DBA to pop open source control, navigate to the file, right click and compare those two versions of the file and then be able to provide meaningful feedback on code that is relevant.  If anyone has any recommendations on how to extract this information from TFS it would be much appreciated! Sample queries would also be great.  If this data is retrievable through the UI in a version later than 2012, I'm looking for that as well.  </p>