tim laqua dot com Thoughts and Code from Tim Laqua

7Oct/082

Locating All Checked Out Excel Documents in SharePoint (WSS 3.0)

SELECT 
	DirName,
	LeafName,
	tp_Email, 
	CheckoutDate, 
	IsCheckoutToLocal
FROM     
	AllDocs d WITH(nolock) 
	INNER JOIN Webs w WITH(nolock) ON d.WebId = w.Id
	INNER JOIN Sites s WITH(nolock) ON w.SiteId = s.Id
	INNER JOIN UserInfo u WITH(nolock) ON (s.Id=u.tp_SiteID AND u.tp_ID=CheckoutUserId)
WHERE
	d.Type <> 1 
	AND (LeafName LIKE '%.xls' OR LeafName LIKE '%.xlsx') 
	AND (LeafName NOT LIKE '%template%')
	AND DeleteTRansactionId = CAST(0 AS VARBINARY)
	AND IsCurrentVersion = 1
	AND IsCheckoutToLocal = 1
ORDER BY
	tp_Email ASC