Tuesday, February 7, 2012

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 Document Contents.
  • The Contents of the document are stored in Content Column in the AllDocStream table.
  • The Content column is the Image Datatype, (stores in the format of Binary).
I provide a simple SQL Query to retrieve the Document List Name,File Name, URL, and the Content (Binary Format)
SELECT AllLists.tp_Title AS ‘List Name’,
AllDocs.LeafName AS ‘File Name’,
AllDocs.DirName AS ‘URL’,
AllDocStreams.Content AS ‘Document Contnt (Binary)’ 
FROM AllDocs 
JOIN AllDocStreams 
ON 
AllDocs.Id=AllDocStreams.Id 
JOIN AllLists 
ON
AllLists.tp_id = AllDocs.ListId
By Sooner, I’ll come up with other interesting Sql Query Tips.

No comments:

Post a Comment