I'm running SharePoint 2010 and SQL Server 2008 R2.

It's hugely important that I create a list of every file within a given content database that has been modified today, 10/31. Will this query do it or will it leave anything -anything at all- out?

SELECT [DirName], 
FROM   [WSS_Content_TARGETDB].[dbo].[AllDocs] 
WHERE  [TimeLastModified] BETWEEN '20121031' AND '20121101';

I'm crossing my fingers that this will list everything without any gaps.


(unless there is no other option)

This will probably work with the current patches it might, but it's not documented or guaranteed and even thought it might work now it might stop working if a patch is applied.

Have you consider using the change log which is meant exactly for getting things like this?
See Using the Change Log

| improve this answer | |
  • This isn't meant to be an ongoing solution for something, I just need to create a comprehensive list of files that were modified on 10/31/2012. I'll use any method that will give me a complete list. – newuser Oct 31 '12 at 20:06
  • 1
    If you have configured the Usage and Health Data collection in Central Administration Web site, you can use the Web Analytics reports to get the insight you are looking for, plus more. – H A Oct 31 '12 at 20:32
  • @HosseinAarabi - Can you go into greater detail on that, please? – newuser Oct 31 '12 at 20:33
  • 1
    I will point you to two blogs where they show you how to configure this service: blogs.msdn.com/b/ecm/archive/2010/05/03/… and codeproject.com/Articles/70865/SharePoint-2010-Logging-Database – H A Oct 31 '12 at 20:35
  • 1
    Also, the Usage database is the only SharePoint database that is OK for you to read against. As Per Jakobsen mentioned, you should never directly access or modify any other SP database. – H A Oct 31 '12 at 20:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.