Skip to content

Commit f8ed6b8

Browse files
committed
Added SQL Server Script To List SharePoint File Lengths
1 parent 0bf1ac8 commit f8ed6b8

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/* SharePoint: SQL Query to list Folders and Files Length Counts for Libraries in your content DB */
2+
3+
-- Usage: Works on content databases for both MOSS 2007 and SharePoint Server 2010 / 2013 Farms
4+
5+
select top 100 --Change this value to the 'top' number of documents you want to report on
6+
7+
SUM(len(dirname)+len(leafname)) as Total,
8+
9+
len(dirname) as DirLength,
10+
11+
dirname,
12+
13+
len(leafname) as LeafLength,
14+
15+
leafname
16+
17+
from alldocs with (NOLOCK)
18+
19+
where DeleteTransactionID = 0x
20+
21+
and IsCurrentVersion= 1
22+
23+
group by dirname, leafname
24+
25+
having cast(SUM(len(dirname)+len(leafname)) as int) > 260 --Change this value to the 'Total' number of characters you want to query
26+
27+
order by total desc

0 commit comments

Comments
 (0)