Is there a reason not to use DateTime2?

Am I missing a reason not to use the new DateTime2 data type?

For example, there may be a problem when switching to another database system or integration with another technology?

+4
source share
3 answers

One of the final articles is Tibor Karashi.

In favor:

  • Best accuracy
  • Potentially less storage

But it's probably best to judge by the frequency of the questions here:

  • Better support for ANSI date formats (yyyy-mm-dd is otherwise unsafe)
+5
source

If you are lucky that you use nothing but Sql Server 2008, and can guarantee that you will be a long time, I see no reason why you should not use it if you need to.

I think the answers to this question will explain this better than I can.

However, the reasons for not using it will be largely the same as what you describe, that is, they will not be recognized in earlier versions of Sql Server, so some transformation will be required to move the data between them.

Similarly, datetime2 has higher precision, and if you write code that depends on this level of accuracy, then you are blocked to always use this data type.

+1
source

One of the reasons is not: I had difficulty using datetime2 and the latest SQL sqljdbc4.jar file from Microsoft (version 3.0) . Of course, if you are not using JDBC, it probably doesn't matter. You can also use Microsoft sqljdbc4.jar version 2.0 or try the jTDS JDBC driver .

+1
source

All Articles