Below list is major difference between Datetime and Datetime2
in Sql Server;
|
Datetime
|
Datetime2
|
Storage Size
|
8 byte
|
6-8 Byte.
|
Min Value
|
1753-01-01 00:00:00
|
0001-01-01 00:00:00
|
Current Datetime
|
GetDate() - returns DB Current DateTime of datetime
Data Type
|
SYSDATETIME() - returns
Current DateTime of DateTime2 Data Type
|
+/- Operator
|
+/- operator works,
e.g GetDate() + 1
|
+/- operator not works; DateAdd function required to add date.
|
Syntax
|
Declare @now datetime
|
Declare @now datetime2(7)
|
No comments:
Post a Comment