SharePoint Blogs / SharePoint University
SharePoint Blogs and SharePoint University - all in one place!
Need SharePoint Training? Attend a SharePoint Bootcamp!

Please delete cookies related to sharepointblogs.com and sharepointu.com to resolve login issues!

SharePoint SQL double feature: find large documents; find email addresses

Here's a couple quick queries to try against a SharePoint content database. Nothing too interesting, but I've found them useful once or twice as a SharePoint administrator, so I thought I'd share them.

The usual caveats about running queries directly apply, of course. Microsoft's Keith Richie puts it best in his latest post about finding orphan sites (a good read, by the way):

DISCLAIMER: This post shows using Query Analyzer to query data in your SharePoint sites. By no means does this mean that you should change any thing in the database. This is simply for "READING" values. And even this should be done during Off-Peak hours.

This first query finds the 100 largest documents across all sites in the current content database. Can be useful for identifying bottlenecks.

  SELECT TOP 100      DirName + '/' + LeafName AS name,      DATALENGTH(Content) AS contentlen  FROM      Docs  --WHERE  --    (LeafName LIKE '%.doc')    -- optionally, find documents of this type  ORDER BY      contentlen DESC  

Second, here's a query to find email addresses by pattern. Keep in mind that data mining for email addresses is kinda evil... just make sure you're doing this for a good cause. :-)

One such cause: A number of your users have alphanumeric pagers with their own email addresses (e.g., 5558675309@pager.phonecompany.com). These email addresses are set up to receive certain alerts from certain lists (e.g., custom lists named "High-Priority Service Requests" and the like.) Your company needs to know what those numbers are. And you'd rather not dig through multiple pages of user info on multiple sites, searching for email addresses not matching the pattern "@example.com". The solution:

  SELECT      UserInfo.tp_Email,      UserInfo.tp_Login,      UserInfo.tp_Title,      UserInfo.tp_Notes,      UserInfo.tp_Deleted,      UserInfo.tp_SiteAdmin,      Sites.FullUrl  FROM      Sites,      UserInfo  WHERE      Sites.Id = UserInfo.tp_SiteId      AND ASCII(UserInfo.tp_Email) > 0      AND UserInfo.tp_Email NOT LIKE '%@example.com'  ORDER BY      UserInfo.tp_Email

Finally: I've got a really neat (and unambiguously useful, for once) query coming up later, so stay tuned.

-->

Posted 11-02-2005 3:21 AM by Unclaimed Blog

Comments

kak wrote re: SharePoint SQL double feature: find large documents; find email addresses
on 01-31-2008 8:41 AM

What a hopeless desert of data a database file can be. Sharepoint? Swearpoint!

garry-oa wrote re: SharePoint SQL double feature: find large documents; find email addresses
on 02-18-2009 12:54 PM

<a href= http://index1.kazluk.ru >����� ������</a> <a href= http://index2.kazluk.ru >������� � ������</a> <a href= http://index3.kazluk.ru >���������� ������ acdsee</a> <a href= http://index4.kazluk.ru >ftp ����� ���������</a> <a href= http://index5.kazluk.ru >neva ��������� ��������� ��������� ������</a>

garry-oa wrote re: SharePoint SQL double feature: find large documents; find email addresses
on 02-18-2009 12:54 PM

<a href= http://index1.kazluk.ru >����� ������</a> <a href= http://index2.kazluk.ru >������� � ������</a> <a href= http://index3.kazluk.ru >���������� ������ acdsee</a> <a href= http://index4.kazluk.ru >ftp ����� ���������</a> <a href= http://index5.kazluk.ru >neva ��������� ��������� ��������� ������</a>

jyner_ve wrote re: SharePoint SQL double feature: find large documents; find email addresses
on 02-21-2009 8:36 AM

<a href= http://index1.inikygu.com >nevada drivers ed</a> <a href= http://index2.inikygu.com >frank ruby payne texas</a> <a href= http://index3.inikygu.com >degenerative cyst</a> <a href= http://index4.inikygu.com >tri-townrestorationcommittee</a> <a href= http://index5.inikygu.com >telemundo and press releases</a>

jyner_ve wrote re: SharePoint SQL double feature: find large documents; find email addresses
on 02-21-2009 8:36 AM

<a href= http://index1.inikygu.com >nevada drivers ed</a> <a href= http://index2.inikygu.com >frank ruby payne texas</a> <a href= http://index3.inikygu.com >degenerative cyst</a> <a href= http://index4.inikygu.com >tri-townrestorationcommittee</a> <a href= http://index5.inikygu.com >telemundo and press releases</a>

jyner_mc wrote re: SharePoint SQL double feature: find large documents; find email addresses
on 02-21-2009 12:57 PM

<a href= http://index1.enovehu.com >pilsbury slogan</a> <a href= http://index2.enovehu.com >chorus line monologue</a> <a href= http://index3.enovehu.com >msnotm</a> <a href= http://index4.enovehu.com >kennett high school</a> <a href= http://index5.enovehu.com >ft sill basic training</a>

jyner_mc wrote re: SharePoint SQL double feature: find large documents; find email addresses
on 02-21-2009 12:57 PM

<a href= http://index1.enovehu.com >pilsbury slogan</a> <a href= http://index2.enovehu.com >chorus line monologue</a> <a href= http://index3.enovehu.com >msnotm</a> <a href= http://index4.enovehu.com >kennett high school</a> <a href= http://index5.enovehu.com >ft sill basic training</a>

jyner_qq wrote re: SharePoint SQL double feature: find large documents; find email addresses
on 02-28-2009 10:54 PM

<a href= http://adultchatsfinder.com >dating</a>

garry-gw wrote re: SharePoint SQL double feature: find large documents; find email addresses
on 02-28-2009 11:22 PM

<a href= adultpersonalsfinder.com >dating</a>

garry-ol wrote re: SharePoint SQL double feature: find large documents; find email addresses
on 03-18-2009 8:32 AM

<a href= http://index4.afigel.ru >������������� ������� ����� 13</a> <a href= http://index2.afigel.ru >���� ��������� ���������</a> <a href= http://index1.afigel.ru >�� �����</a> <a href= http://index5.afigel.ru >������� ������� ������ ���� ������</a> <a href= http://index3.afigel.ru >kjwvfy</a>

jyner_wm wrote re: SharePoint SQL double feature: find large documents; find email addresses
on 03-25-2009 3:22 AM

<a href= http://index3.va-ta.ru >���������� ����������� icq</a> <a href= http://index2.va-ta.ru >�������� samsung sgh d800</a> <a href= http://index1.va-ta.ru >����������� ����� ������ ���������������</a> <a href= http://index5.va-ta.ru >���������� ����������� �����</a> <a href= http://index4.va-ta.ru >www icq wen ru</a>

jyner_rx wrote re: SharePoint SQL double feature: find large documents; find email addresses
on 04-27-2009 11:28 AM

<a href=  ></a>

jyner_bs wrote re: SharePoint SQL double feature: find large documents; find email addresses
on 04-27-2009 3:04 PM

<a href=  ></a>

Add a Comment

(required)  
(optional)
(required)  
Remember Me?
Need SharePoint Training? Attend a SharePoint Bootcamp!
Posts (c) their respective authors. Everything else (c) 2009 SharePoint Experts, Inc.