在排查SharePoint问题的时候, 经常需要到SharePoint的数据库中进行查询, 有时候就需要对时间进行一些操作.

比如说, 在排查Alert的问题的时候, 经常需要用到下面的一句查询:

Select ItemName, EventData, ACL, EventTime
from EventCache 
where (ACL is not null) and 
    (EventData is not null)
order by eventtime desc

 

但是这里的EventTime是GMT时间, 对于我们中国来说, 看起来不太直观, 因为我们使用的是GMT+8的北京时间. 可以使用下面的语句来对结果进行更正.

Select ItemName, EventData, ACL, DATEADD(HOUR, 8, EventTime)
from EventCache 
where (ACL is not null) and 
    (EventData is not null)
order by eventtime desc

 

至于要修改年, 月, 日什么的, 都可以在下面的文档中找到答案.

DATEADD (Transact-SQL)

http://msdn.microsoft.com/en-us/library/ms186819.aspx

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-14
  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
  • 2021-07-09
猜你喜欢
  • 2021-12-28
  • 2021-10-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案