小编Mat*_*int的帖子

Understanding MS SQL Server Date Types

Consider the following:

declare @dt datetime, @dt2 datetime2, @d date
set @dt  = '2013-01-01'
set @dt2 = '2013-01-01'
set @d   = '2013-01-01'

select convert(varbinary, @dt) as dt,
       convert(varbinary, @dt2) as dt2,
       convert(varbinary, @d) as d
Run Code Online (Sandbox Code Playgroud)

Output:

dt                    dt2                     d
------------------    --------------------    --------
0x0000A13900000000    0x07000000000094360B    0x94360B
Run Code Online (Sandbox Code Playgroud)

Now, I already understand from the documentation that datetime has a smaller range, and starts from 1753-01-01, while datetime2 and date use 0001-01-01 as their start date.

What I don't understand though, is that datetime …

sql-server datatypes sql-clr datetime user-defined-type

7
推荐指数
1
解决办法
991
查看次数