w1w 发表于 2019-2-4 12:14:55

对SharePoint 2007数据库中一些数据表的使用(一)

  在工作中接触了一些SharePoint的数据库中的一些表。在此做个总结。
  一位高手告诉我了与Content Database相关的三个表:
  AllUserData            AllDocs            AllDocStreams
  我就是从这三个表开始研究的。而且在研究中发现 AllLists表也很重要,但遗憾的是没在msdn上找到对这个表的说明。
  表中每列的含义我就不多说了,在msdn上都有。 我在此举几个例子来介绍一下这些表的使用。
  1. 得到用户上传的文档的数目:
  select count(*) as DocNumber from dbo.AllDocs
where '' and > 0 and in
(select from dbo.AllLists where = 101 and > 0)
  注:AllLists列表中记录着所有列表的信息,此处所说的列表指的是所有SPList对象。
  2. 得到每个文档的平均大小:
  --declare variables
declare @file_size int
set @file_size = 0
set @file_size = (select sum(Cast( as bigint)) as DocSize from dbo.AllDocs
where '' and > 0 and in
(select from dbo.AllLists where = 101 and > 0))
set @file_size = @file_size / 1024
print(@file_size);
  注:字段是以Byte为单位的,所以要将其变为bigint类型。
  3. 得到文档库中文档的格式及相应的数目:
  select , count(*) as FileCount from dbo.AllDocs
where '' and > 0 and in
(select from dbo.AllLists where = 101 and > 0)
group by order by desc
  暂时先说这些,明天接着写。



页: [1]
查看完整版本: 对SharePoint 2007数据库中一些数据表的使用(一)