Posted by Shantha Kumar on 14th April 2009

SharePoint Database SQL Query Tips4

Where are the Documents or files we uploaded or attached stored in sharepoint? Many of them know, those files are stored under SharePoint Content Database. But on which database table, on which format?
For that, i did a quick research on that, and here i give those results,

The AllDocStreams table in SharePoint Content Database stores the [...]

Posted by Shantha Kumar on 23rd March 2009

SharePoint Database SQL Query Tips3

Now, we are going to retrive the file details from AllDocs Database. Which has the informations about the files stored in SharePoint List or Library.
– Returns all document from all lists availabe in WebApplication
SELECT AllDocs.Leafname AS FileName’, 
                 AllDOcs.Dirname AS ‘Folder Path’, 
                 AllLists.tp_Title AS ‘List Title’,
                 Webs.Title AS ‘Web Title’
FROM AllDocs
JOIN AllLists
ON
AllLists.tp_Id=AllDocs.ListId
JOIN Webs
ON
Webs.Id=AllLists.tp_WebId
ORDER BY webs.title
If you need the file informations about particular document type. Use [...]

Posted by Shantha Kumar on 19th March 2009

SharePoint Database SQL Query Tips2

Today, we are going to see the query for returning Webs and Site Collections available in the Database (WebApplication).
–Returns Total Number of Site Collections in WebApplication
select  count(*) as ‘Total Site Collection’ from sites
–Returns Root Site Title for each Site Collection available in WebApplication
 select Title as ‘Root Web Title’, Sites.RootWebId, Sites.Id as ‘Site Collection ID’ from webs inner [...]