Yesterday I started looking at the tables in my SharePoint 2010's Content databases for the first time and I noticed something a little unnerving: There were files that were checked out and the web front end was not displaying them in any way.
More specifically I ran this query against one of my CDBs:
USE WSS_Content_IT
SELECT
AD.DirName,
AD.LeafName,
UI.tp_Login
FROM
dbo.AllDocs AS AD FULL JOIN
dbo.UserInfo AS UI ON
UI.tp_ID = AD.CheckoutUserId
WHERE
UI.tp_Login IS NOT NULL AND
AD.DirName IS NOT NULL
...and it returned just over a thousand rows. About a dozen of them were files I expected to be checked out, but the rest all belonged in the same folder, one I remember populating weeks ago. When I used the web interface to find the offending folder it appeared to not exist. Even when I was logged in with the account listed under tp_Login
the folder simply wasn't there to be browsed. These files are acting specifically like they've never had a version checked-in and the "Manage files which have no checked in version" link under Document Library Settings doesn't display these files either.
So I ran the same query against my other CDBs and discovered that this has happened to all of them. Clearly this is a problem.
So since I can't check these documents in by using the web interface, and they don't show up in SharePoint Designer either, how can I use a SQL query to force a check-in of these files?