对SharePoint 2007数据库中一些数据表的使用(二) 推荐
2011-03-27 23:23
363 查看
接着写
1. 得到文档库的大小
dbo.Webs 记录了每个SPWeb对象的FullUrl和Guid.
dbo.Sites 记录了每个SPSite对象的GUID,可以与dbo.Webs、dbo.AllDocs对象联合起来使用。
select [ListId] as [LibId], [tp_Title] as [LibTitle],dbo.Webs.[FullUrl], (sum(Cast([Size] as bigint)) / (1024)) as [LibSize (KB)]
from dbo.AllDocs, dbo.AllLists, dbo.Webs
where [ExtensionForFile] <> '' and [DoclibRowId] > 0 and [ListId] = [tp_ID] and
[tp_ServerTemplate] in (101,109,111,113,114,115,116,119) and [tp_ItemCount] > 0 and dbo.AllDocs.[SiteId]=
(select dbo.Sites.[Id] from dbo.Sites, dbo.Webs
where dbo.Webs.[SiteId] = dbo.Sites.Id and dbo.Webs.[FullUrl] = '')
and dbo.AllDocs.[WebId] = dbo.Webs.[Id]
Group By [ListId], dbo.Webs.[FullUrl], [tp_Title] order by [LibSize (KB)] desc
注: dbo.Webs.[FullUrl]列存储了每个SPWeb对象的url地址(例如:Teams/Test0223PM0400),当此SPWeb对象是根站点的web对象时,此处值为空字符串。
2. 得到在某段时间内更新的文档数
--declare variables
declare @start_time datetime, @end_time datetime
--set UTC DateTime
set @start_time = cast('2010-12-27 08:08:33' as datetime)
set @end_time = cast('2010-12-28 02:35:21' as datetime)
select count(*) from dbo.AllDocs
where [ExtensionForFile] <> '' and [DoclibRowId] > 0 and [ListId] in
(select [tp_ID] from dbo.AllLists where [tp_ServerTemplate] = 101 and [tp_ItemCount] > 0)
and ([MetaInfoTimeLastModified] between @start_time and @end_time)
注:dbo.AllDocs表中的[TimeCreated], [TimeLastModified], [NextToLastTimeModified], [MetaInfoTimeLastModified], 以及[TimeLastWritten]列都使用UTC时间。
3. 得到最常使用的文档格式及数目
select [ExtensionForFile], count(*) as 'AttachmentCount' from AllDocs
where DoclibRowId is null and [DeleteTransactionId] = 0x and [Type] = 0
and [HasStream] = 1 and ListId in
(select tp_ID from dbo.AllLists where [tp_ServerTemplate] in (100,107,108,150,1100) and [tp_ItemCount] > 0)
group by [ExtensionForFile] order by [AttachmentCount] desc
注: [DeleteTransactionId] 指示该listitem是否已被删除,未删除则值应为0x。
[HasStream] 指示此item是否含有文件流,1表示含有。
[Type] 指示此文档的‘Document Store Type’, 0表示文件,1表示文件夹。
4. 从站点集的Url地址得到所在数据库的名字
此处需要用到SharePoint的配置数据库(默认名称为:SharePoint_Config )
select dbo.objects.[name] from dbo.objects, dbo.sitemap
where dbo.objects.[ID] = dbo.sitemap.[databaseID] and dbo.sitemap.[path] = '/AK/StrategicIndustries'
注:dbo.objects.[name] –> 数据库的名称存在于此列。
dbo.sitemap.[path] –> 记录着站点集的路径。
附件:http://down.51cto.com/data/2357822
1. 得到文档库的大小
dbo.Webs 记录了每个SPWeb对象的FullUrl和Guid.
dbo.Sites 记录了每个SPSite对象的GUID,可以与dbo.Webs、dbo.AllDocs对象联合起来使用。
select [ListId] as [LibId], [tp_Title] as [LibTitle],dbo.Webs.[FullUrl], (sum(Cast([Size] as bigint)) / (1024)) as [LibSize (KB)]
from dbo.AllDocs, dbo.AllLists, dbo.Webs
where [ExtensionForFile] <> '' and [DoclibRowId] > 0 and [ListId] = [tp_ID] and
[tp_ServerTemplate] in (101,109,111,113,114,115,116,119) and [tp_ItemCount] > 0 and dbo.AllDocs.[SiteId]=
(select dbo.Sites.[Id] from dbo.Sites, dbo.Webs
where dbo.Webs.[SiteId] = dbo.Sites.Id and dbo.Webs.[FullUrl] = '')
and dbo.AllDocs.[WebId] = dbo.Webs.[Id]
Group By [ListId], dbo.Webs.[FullUrl], [tp_Title] order by [LibSize (KB)] desc
注: dbo.Webs.[FullUrl]列存储了每个SPWeb对象的url地址(例如:Teams/Test0223PM0400),当此SPWeb对象是根站点的web对象时,此处值为空字符串。
2. 得到在某段时间内更新的文档数
--declare variables
declare @start_time datetime, @end_time datetime
--set UTC DateTime
set @start_time = cast('2010-12-27 08:08:33' as datetime)
set @end_time = cast('2010-12-28 02:35:21' as datetime)
select count(*) from dbo.AllDocs
where [ExtensionForFile] <> '' and [DoclibRowId] > 0 and [ListId] in
(select [tp_ID] from dbo.AllLists where [tp_ServerTemplate] = 101 and [tp_ItemCount] > 0)
and ([MetaInfoTimeLastModified] between @start_time and @end_time)
注:dbo.AllDocs表中的[TimeCreated], [TimeLastModified], [NextToLastTimeModified], [MetaInfoTimeLastModified], 以及[TimeLastWritten]列都使用UTC时间。
3. 得到最常使用的文档格式及数目
select [ExtensionForFile], count(*) as 'AttachmentCount' from AllDocs
where DoclibRowId is null and [DeleteTransactionId] = 0x and [Type] = 0
and [HasStream] = 1 and ListId in
(select tp_ID from dbo.AllLists where [tp_ServerTemplate] in (100,107,108,150,1100) and [tp_ItemCount] > 0)
group by [ExtensionForFile] order by [AttachmentCount] desc
注: [DeleteTransactionId] 指示该listitem是否已被删除,未删除则值应为0x。
[HasStream] 指示此item是否含有文件流,1表示含有。
[Type] 指示此文档的‘Document Store Type’, 0表示文件,1表示文件夹。
4. 从站点集的Url地址得到所在数据库的名字
此处需要用到SharePoint的配置数据库(默认名称为:SharePoint_Config )
select dbo.objects.[name] from dbo.objects, dbo.sitemap
where dbo.objects.[ID] = dbo.sitemap.[databaseID] and dbo.sitemap.[path] = '/AK/StrategicIndustries'
注:dbo.objects.[name] –> 数据库的名称存在于此列。
dbo.sitemap.[path] –> 记录着站点集的路径。
附件:http://down.51cto.com/data/2357822
相关文章推荐
- 对SharePoint 2007数据库中一些数据表的使用(一)
- 对SharePoint 2007数据库中一些数据表的使用
- 对SharePoint 2007数据库中一些数据表的使用
- 对SharePoint 2007数据库中一些数据表的使用
- 难点总结:Jquery动态加载数据库中的数据(解答人:郭哲 方式:讲述jquery原理及一些函数的使用方法,学会看帮助文档)
- C# 使用DateTimePicker与数据库中类型为datetime的数据作比较的一些注意事项
- SQL语句操作数据与一些函数使用的丰富数据库
- Sharepoint 2007 BDC(业务数据目录)连接数据库,并绑定到业务数据列表上显示数据
- 使用 SQL 语句从数据库一个表中随机获取一些数据
- 使用 SQL 语句从数据库一个表中随机获取一些数据
- 安卓开发SQlite使用执行SQL语句一些简单的处理——1.创建数据库,表和添加数据
- PHP-Excel读取导入Excel数据到数据库(2003,2007通用)使用方法
- 深入浅出SharePoint2007——使用服务器变量过滤XSLT Webpart数据
- 1 开发一个注重性能的JDBC应用程序不是一件容易的事. 当你的代码运行很慢的时候JDBC驱动程序并不会抛出异常告诉你。 本系列的性能提示将为改善JDBC应用程序的性能介绍一些基本的指导原则,这其中的原则已经被许多现有的JDBC应用程序编译运行并验证过。 这些指导原则包括: 正确的使用数据库MetaData方法 只获取需要的数据 选用最佳性能的功能 管理连
- 使用SharePoint的数据视图,显示现有数据库中的数据[转载]
- 使用 SQL 语句从数据库一个表中随机获取一些数据
- Infopath在SharePoint中使用的一些注意事项(一) 推荐
- 使用 SQL 语句从数据库一个表中随机获取一些数据
- sharepoint 2007 使用命令 Mergecontentdbs 迁移迁移站点集到新db的一些说明
- 安卓开发SQlite使用执行SQL语句一些简单的处理——2.查询数据库的数据