Should DateKey YYYYMMDD be char(8)?

白昼怎懂夜的黑 提交于 2020-01-05 19:29:50

问题


The two most important fields, that are everywhere in our warehouse, are the UserAccountKey and the DateKey.

  • DateKey is (int, not null)
  • UserAccountKey is (int, not null)

Are these the correct data type?

The WH was created in 2006 so type Date wasn't an option, although we are now running 2008-R2 so it is now an option for the next iteration of the WH. It's a well established WH with multiple cubes built from it and a whole reporting system. Additional question to the above is when the WH was created would the architect have been better having the DateKey as type Char(8) rather than INT?


回答1:


There's actually a data type especially for dates. I'd change the DateKey type from int to date.



来源:https://stackoverflow.com/questions/11170677/should-datekey-yyyymmdd-be-char8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!