<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Welcome to ShanthaKumar&#039;s Blog, SharePoint and more... &#187; SharePoint Database</title>
	<atom:link href="http://www.ktskumar.com/blog/tag/sharepoint-database/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ktskumar.com</link>
	<description>more Points to Share....</description>
	<lastBuildDate>Tue, 13 Dec 2011 17:36:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>SharePoint Database SQL Query Tips4</title>
		<link>http://www.ktskumar.com/blog/2009/04/sharepoint-database-sql-query-tips4/</link>
		<comments>http://www.ktskumar.com/blog/2009/04/sharepoint-database-sql-query-tips4/#comments</comments>
		<pubDate>Tue, 14 Apr 2009 18:05:15 +0000</pubDate>
		<dc:creator>Shantha Kumar</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint Database]]></category>
		<category><![CDATA[Sql Query]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://ktskumar.wordpress.com/?p=154</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>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?</p>
<p>For that, i did a quick research on that, and here i give those results,</p>
<ul>
<li>The <strong>AllDocStreams</strong> table in SharePoint Content Database stores the Document Contents.</li>
<li>The Contents of the document are stored in <strong>Content </strong>Column in the <strong>AllDocStream</strong> table.</li>
<li>The <strong>Content</strong> column is the <strong>Image Datatype</strong>, (stores in the format of Binary).</li>
</ul>
<p>I provide a simple SQL Query to retrieve the Document List Name,File Name, URL, and the Content (Binary Format)</p>
<p><span><span style="color:#0000ff;">SELECT</span></span> <span>AllLists</span><span>.</span><span>tp_Title </span><span style="color:#0000ff;">AS</span><span> </span><span style="color:#ff0000;">&#8216;List Name&#8217;</span><span style="color:#808080;">,</span><br />
<span><span>AllDocs.LeafName </span></span><span style="color:#0000ff;">AS</span><span> </span><span style="color:#ff0000;">&#8216;File Name&#8217;</span><span style="color:#808080;">,</span><br />
<span><span>AllDocs.DirName </span></span><span style="color:#0000ff;">AS</span><span> </span><span style="color:#ff0000;">&#8216;URL&#8217;</span><span style="color:#808080;">,</span><br />
<span><span>AllDocStreams</span></span><span style="color:#808080;">.</span><span>Content </span><span style="color:#0000ff;">AS</span><span> </span><span style="color:#ff0000;">&#8216;Document Contnt (Binary)&#8217;</span><span> </span><br />
<span style="color:#0000ff;"><span style="color:#0000ff;">FROM </span></span><span>AllDocs </span><br />
<span style="color:#808080;"><span style="color:#808080;">JOIN </span></span><span>AllDocStreams </span><br />
<span style="color:#0000ff;"><span style="color:#0000ff;">ON </span></span><br />
<span><span>AllDocs</span></span><span style="color:#808080;">.</span><span>Id</span><span style="color:#808080;">=</span><span>AllDocStreams</span><span style="color:#808080;">.</span><span>Id </span><br />
<span style="color:#808080;"><span style="color:#808080;">JOIN </span></span><span>AllLists </span><br />
<span style="color:#0000ff;"><span style="color:#0000ff;">ON</span></span><br />
<span><span>AllLists</span></span><span style="color:#808080;">.</span><span>tp_id </span><span style="color:#808080;">=</span><span> AllDocs</span><span style="color:#808080;">.</span><span>ListId</span></p>
<p><span>By Sooner, I&#8217;ll come up with other interesting Sql Query Tips.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ktskumar.com/blog/2009/04/sharepoint-database-sql-query-tips4/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SharePoint Database SQL Query Tips3</title>
		<link>http://www.ktskumar.com/blog/2009/03/sharepoint-database-sql-query-tips3/</link>
		<comments>http://www.ktskumar.com/blog/2009/03/sharepoint-database-sql-query-tips3/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 10:33:00 +0000</pubDate>
		<dc:creator>Shantha Kumar</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[SharePoint Database]]></category>
		<category><![CDATA[Sql Query]]></category>
		<category><![CDATA[Tips Series]]></category>

		<guid isPermaLink="false">http://ktskumar.wordpress.com/?p=139</guid>
		<description><![CDATA[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. &#8211; Returns all document from all lists availabe in WebApplication SELECT AllDocs.Leafname AS FileName&#8217;,                   AllDOcs.Dirname AS &#8216;Folder Path&#8217;,                   AllLists.tp_Title AS &#8216;List Title&#8217;,                  Webs.Title AS &#8216;Web Title&#8217; FROM AllDocs JOIN AllLists ON AllLists.tp_Id=AllDocs.ListId JOIN Webs ON [...]]]></description>
			<content:encoded><![CDATA[<p>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.</p>
<p><span style="color:#009900;">&#8211; Returns all document from all lists availabe in WebApplication</span><br />
<span style="color:#0000ff;">SELECT</span> AllDocs.Leafname <span style="color:#0000ff;">AS </span><span style="color:#ff0000;">FileName&#8217;</span>, <br />
                 AllDOcs.Dirname <span style="color:#0000ff;">AS</span> <span style="color:#ff0000;">&#8216;Folder Path&#8217;</span>, <br />
                 AllLists.tp_Title <span style="color:#0000ff;">AS</span> <span style="color:#ff0000;">&#8216;List Title&#8217;</span>,<br />
                 Webs.Title <span style="color:#0000ff;">AS</span> <span style="color:#ff0000;">&#8216;Web Title&#8217;</span><br />
<span style="color:#0000ff;">FROM</span> AllDocs<br />
<span style="color:dimgray;">JOIN</span> AllLists<br />
<span style="color:#0000ff;">ON</span><br />
AllLists.tp_Id=AllDocs.ListId<br />
<span style="color:dimgray;">JOIN</span> Webs<br />
<span style="color:#0000ff;">ON</span><br />
Webs.Id=AllLists.tp_WebId<span style="color:#0000ff;"><br />
ORDER BY</span> webs.title</p>
<p>If you need the file informations about particular document type. Use the Extension column to check the document type.</p>
<p>For Ex., The following Query returns only master pages on all WebSites,</p>
<p><span style="color:#009900;">&#8211; Returns master pages in WebApplication for all WebSites</span><br />
<span style="color:#0000ff;">SELECT</span> AllDocs.Leafname <span style="color:#0000ff;">AS </span><span style="color:#ff0000;">FileName&#8217;</span>, <br />
                 AllDocs.Dirname <span style="color:#0000ff;">AS</span> <span style="color:#ff0000;">&#8216;Folder Path&#8217;</span>, <br />
                 AllLists.tp_Title <span style="color:#0000ff;">AS</span> <span style="color:#ff0000;">&#8216;List Title&#8217;</span>,<br />
                 Webs.Title <span style="color:#0000ff;">AS</span> <span style="color:#ff0000;">&#8216;Web Title&#8217;</span><br />
<span style="color:#0000ff;">FROM</span> AllDocs<br />
<span style="color:dimgray;">JOIN</span> AllLists<br />
<span style="color:#0000ff;">ON </span><br />
AllLists.tp_Id=AllDocs.ListId<br />
<span style="color:dimgray;">JOIN</span> Webs<br />
<span style="color:#0000ff;">ON</span><br />
Webs.Id=AllLists.tp_WebId<span style="color:#0000ff;"><br />
</span><span style="color:#0000ff;">WHERE </span><span style="color:#000000;">Extension=&#8217;master&#8217;</span><br />
<span style="color:#000000;"><span style="color:#0000ff;">ORDER BY</span> Webs.Title</span></p>
<p>Like the above query, we can get all type of documents.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ktskumar.com/blog/2009/03/sharepoint-database-sql-query-tips3/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>SharePoint Database SQL Query Tips2</title>
		<link>http://www.ktskumar.com/blog/2009/03/sharepoint-database-sql-query-tips2/</link>
		<comments>http://www.ktskumar.com/blog/2009/03/sharepoint-database-sql-query-tips2/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 16:56:45 +0000</pubDate>
		<dc:creator>Shantha Kumar</dc:creator>
				<category><![CDATA[MOSS]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint Database]]></category>
		<category><![CDATA[Sql Query]]></category>
		<category><![CDATA[Tips Series]]></category>

		<guid isPermaLink="false">http://ktskumar.wordpress.com/?p=136</guid>
		<description><![CDATA[Today, we are going to see the query for returning Webs and Site Collections available in the Database (WebApplication). &#8211;Returns Total Number of Site Collections in WebApplication select  count(*) as &#8216;Total Site Collection&#8217; from sites &#8211;Returns Root Site Title for each Site Collection available in WebApplication  select Title as &#8216;Root Web Title&#8217;, Sites.RootWebId, Sites.Id as &#8216;Site Collection [...]]]></description>
			<content:encoded><![CDATA[<p>Today, we are going to see the query for returning Webs and Site Collections available in the Database (WebApplication).</p>
<p><span style="font-size:x-small;color:#008000;">&#8211;Returns Total Number of Site Collections in WebApplication<br />
</span><span style="font-size:x-small;color:#0000ff;"><span style="font-size:x-small;color:#0000ff;">select </span></span><span style="font-size:x-small;"> </span><span style="font-size:x-small;color:#ff00ff;">count</span><span style="font-size:x-small;color:#808080;">(*)</span><span style="font-size:x-small;"> </span><span style="font-size:x-small;color:#0000ff;">as</span><span style="font-size:x-small;"> </span><span style="font-size:x-small;color:#ff0000;">&#8216;Total Site Collection&#8217; </span><span style="font-size:x-small;color:#0000ff;">from </span><span style="font-size:x-small;">sites</span></p>
<p><span style="font-size:x-small;color:#008000;">&#8211;Returns Root Site Title for each Site Collection available in WebApplication<br />
<span style="font-size:x-small;color:#008000;"> </span></span><span style="font-size:x-small;color:#0000ff;">select </span><span style="font-size:x-small;">Title </span><span style="font-size:x-small;color:#0000ff;">as</span><span style="font-size:x-small;"> </span><span style="font-size:x-small;color:#ff0000;">&#8216;Root Web Title&#8217;</span><span style="font-size:x-small;color:#808080;">,</span><span style="font-size:x-small;"> Sites</span><span style="font-size:x-small;color:#808080;">.</span><span style="font-size:x-small;">RootWebId</span><span style="font-size:x-small;color:#808080;">,</span><span style="font-size:x-small;"> Sites</span><span style="font-size:x-small;color:#808080;">.</span><span style="font-size:x-small;">Id </span><span style="font-size:x-small;color:#0000ff;">as</span><span style="font-size:x-small;"> </span><span style="font-size:x-small;color:#ff0000;">&#8216;Site Collection ID&#8217;</span><span style="font-size:x-small;"> </span><span style="font-size:x-small;color:#0000ff;">from</span><span style="font-size:x-small;"> webs </span><span style="font-size:x-small;color:#808080;">inner</span><span style="font-size:x-small;"> </span><span style="font-size:x-small;color:#808080;">join</span><span style="font-size:x-small;"> Sites </span><span style="font-size:x-small;color:#0000ff;">on</span><span style="font-size:x-small;"> Webs</span><span style="font-size:x-small;color:#808080;">.</span><span style="font-size:x-small;">Id </span><span style="font-size:x-small;color:#808080;">=</span><span style="font-size:x-small;"> Sites</span><span style="font-size:x-small;color:#808080;">.</span><span style="font-size:x-small;">RootWebId</span></p>
<p><span style="font-size:x-small;color:#008000;">&#8211;Returns Total Web Sites in WebApplication<br />
</span><span style="font-size:x-small;color:#0000ff;"><span style="font-size:x-small;color:#0000ff;">select </span></span><span style="font-size:x-small;color:#ff00ff;">count</span><span style="font-size:x-small;color:#808080;">(*)</span><span style="font-size:x-small;"> </span><span style="font-size:x-small;color:#0000ff;">from </span><span style="font-size:x-small;">Webs</span></p>
<p><span style="font-size:x-small;color:#008000;">&#8211;Returns WebSite Title and Site Id</span><br />
<span style="font-size:x-small;color:#0000ff;"><span style="font-size:x-small;color:#0000ff;">select </span></span><span style="font-size:x-small;">Title </span><span style="font-size:x-small;color:#0000ff;">as</span><span style="font-size:x-small;"> </span><span style="font-size:x-small;color:#ff0000;">&#8216;Site title&#8217;</span><span style="font-size:x-small;color:#808080;">,</span><span style="font-size:x-small;">FullUrl</span><span style="font-size:x-small;color:#808080;">,</span><span style="font-size:x-small;"> SiteId </span><span style="font-size:x-small;color:#0000ff;">as</span><span style="font-size:x-small;"> </span><span style="font-size:x-small;color:#ff0000;">&#8216;Site Collection Id&#8217;</span><span style="font-size:x-small;"> </span><span style="font-size:x-small;color:#0000ff;">from</span><span style="font-size:x-small;"> Webs </span><span style="font-size:x-small;color:#0000ff;">order</span><span style="font-size:x-small;"> </span><span style="font-size:x-small;color:#0000ff;">by </span><span style="font-size:x-small;">SiteId</span></p>
<p><span style="font-size:x-small;color:#008000;">&#8211;Returns Total number of Web Sites under each SiteCollection<br />
</span><span style="font-size:x-small;color:#0000ff;"><span style="font-size:x-small;color:#0000ff;">select </span></span><span style="font-size:x-small;">SiteId</span><span style="font-size:x-small;color:#808080;">,</span><span style="font-size:x-small;"> </span><span style="font-size:x-small;color:#ff00ff;">count</span><span style="font-size:x-small;color:#808080;">(*)</span><span style="font-size:x-small;"> </span><span style="font-size:x-small;color:#0000ff;">as</span><span style="font-size:x-small;"> </span><span style="font-size:x-small;color:#ff0000;">&#8216;Total Sub Sites&#8217;</span><span style="font-size:x-small;"> </span><span style="font-size:x-small;color:#0000ff;">from</span><span style="font-size:x-small;"> Webs </span><span style="font-size:x-small;color:#808080;">inner</span><span style="font-size:x-small;"> </span><span style="font-size:x-small;color:#808080;">join</span><span style="font-size:x-small;"> Sites </span><span style="font-size:x-small;color:#0000ff;">on</span><span style="font-size:x-small;"> Sites</span><span style="font-size:x-small;color:#808080;">.</span><span style="font-size:x-small;">Id </span><span style="font-size:x-small;color:#808080;">=</span><span style="font-size:x-small;"> Webs</span><span style="font-size:x-small;color:#808080;">.</span><span style="font-size:x-small;">SiteId </span><span style="font-size:x-small;color:#0000ff;">group</span><span style="font-size:x-small;"> </span><span style="font-size:x-small;color:#0000ff;">by</span><span style="font-size:x-small;"> SiteId</span></p>
<p><span style="font-size:x-small;"><strong><span style="color:#008000;">Webs</span></strong> <span style="color:#000000;">Database stores the informations on Web Sites.</span></span><br />
<span style="font-size:x-small;"><strong><span style="color:#008000;">Sites</span></strong> <span style="color:#000000;">Database stores the informations on Site Collections.</span></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ktskumar.com/blog/2009/03/sharepoint-database-sql-query-tips2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

