資料類型
|
格式
|
範圍
|
精確度
|
儲存體大小 (位元組)
|
使用者自訂的有效秒數小數位數
|
時區位移
|
hh:mm:ss[.nnnnnnn]
|
00:00:00.0000000 到
23:59:59.9999999
|
100 奈秒
|
3 到 5
|
是
|
否
|
|
YYYY-MM-DD
|
0001-01-01 到
9999-12-31
|
1 日
|
3
|
否
|
否
|
|
YYYY-MM-DD hh:mm:ss
|
1900-01-01 到
2079-06-06
|
1 分鐘
|
4
|
否
|
否
|
|
YYYY-MM-DD hh:mm:ss[. nnn]
|
1753-01-01 到
9999-12-31
|
0.00333 秒鐘
|
8
|
否
|
否
|
|
YYYY-MM-DD hh:mm:ss[.nnnnnnn]
|
0001-01-01 00:00:00.0000000 到
9999-12-31 23:59:59.9999999
|
100 奈秒
|
6 到 8
|
是
|
否
|
|
YYYY-MM-DD hh:mm:ss[.nnnnnnn] [+|-]hh:mm
|
0001-01-01 00:00:00.0000000 到
9999-12-31 23:59:59.9999999 (以 UTC 為單位)
|
100 奈秒
|
8 到 10
|
是
|
是
|
declare @Date_Example as date =getdate()
declare @Datetime_Example as dateTime =getdate()
declare @SmallDateTime_Example as SmallDateTime=getdate()
declare @DateTime2_Example as datetime2=getdate()
declare @DateTimeOffset_Example as DateTimeOffset=getdate()
declare @Time_Example as Time=getdate()
select @Date_Example as Date_Example,
@Datetime_Example as Datetime_Example,
@SmallDateTime_Example as SmallDateTime_Example,
@DateTime2_Example as DateTime2_Example,
@DateTimeOffset_Example as DateTimeOffset_Example,
@Time_Example as Time_Example
go
declare @Date_Example as date =SYSDATETIME ()
declare @Datetime_Example as dateTime =SYSDATETIME ()
declare @SmallDateTime_Example as SmallDateTime=SYSDATETIME ()
declare @DateTime2_Example as datetime2=SYSDATETIME ()
declare @DateTimeOffset_Example as DateTimeOffset=SYSDATETIME ()
declare @Time_Example as Time=SYSDATETIME ()
select @Date_Example as Date_Example,
@Datetime_Example as Datetime_Example,
@SmallDateTime_Example as SmallDateTime_Example,
@DateTime2_Example as DateTime2_Example,
@DateTimeOffset_Example as DateTimeOffset_Example,
@Time_Example as Time_Example
沒有留言:
張貼留言