开发者

Why doesn't SQL Server have a pure date and pure time data type?

I have a few SQL Server tables with a datetime field that really only has to contain dates... and the fact that it's a datetime object violates data integrity, because it's possible for data to be inserted with a time - which isn't really valid for this field. The result is tha开发者_StackOverflow社区t we have to convert it and strip off the time every single time we use it. We've considered adding triggers to make sure that no data can even get in with a time attached... but it seems to me that this should really be part of the database software, and shouldn't need to be specifically programmed each time.

Why doesn't SQL Server have separate date and time data types? Is this going to change in the near future? Do other database platforms have this functionality?


SQL Server 2008 has DATE and TIME data types.

What version are you using?


SQL Server has a pure date and time data type since version 2008, they also added a bunch of new datetime types, now it also goes all the way back to year 1 instead of 1753

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜