Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
任何人都知道 SQL Server 的任何临时(http://en.wikipedia.org/wiki/Temporal_database)扩展?
我知道这是一个老问题,但 SQL Server 中通常的解决方案是创建一个可以加入查询的“日期维度”数据库。DateDim 基本上只是一个日期列表,但它包括诸如财政季度和日历季度编号、该月的第一天/最后一天等列:动态计算很难或耗时但很容易从中提取的东西连接表。
如果您搜索“sql 日期维度”,您会发现一些可以为您生成表格的代码,尽管您需要对其进行调整以满足您的需要。它们倾向于每天运行,但如果您需要每小时跟踪,例如,您需要相应地更改代码。
SQL Server 2016 引入了时态数据库功能。
看: