What are the advantages of having a column of type datetime2
in SQL Server instead of a string? Obviously strings are much more flexible. Are there performance advantages while querying?
I'm designing a database where all entries are added via functions in another language and so there's no concern that a value not formatted like a date will be added to the column in question. I'm considering making that column type string so I can more easily parse them when querying. When they are added to the database they are converted from Python's datetime format, which by convention has six digits of precision in fractions of seconds, to datetime2 format which has seven. Making the column be of type string will stop that from happening, but I'm worried about the performance issues that might come with not using datetime2.