SQL服务器:带指数的文字的默认数据类型是什么?
SQL Server: What is the default data type of a literal with an exponent?
带指数的文字的默认数据类型是什么?
例如,文字 5000E0
的默认数据类型是什么
具体来说,我需要确保默认值为 FLOAT
(即 FLOAT(53)
)
如果默认为 REAL
(即 FLOAT(24)
),恐怕会添加额外的隐式转换,从而减慢我的查询速度。
这是一个 64 位浮点数。
select datalength(5000E0)
产出
8
select 5000E0 val into #t
select t.name, t.max_length, t.precision
from tempdb.sys.columns c
join sys.types t
on t.system_type_id = c.system_type_id
where object_id = object_id('tempdb..#t')
产出
name max_length precision
--------- ---------- ---------
float 8 53
带指数的文字的默认数据类型是什么?
例如,文字 5000E0
具体来说,我需要确保默认值为 FLOAT
(即 FLOAT(53)
)
如果默认为 REAL
(即 FLOAT(24)
),恐怕会添加额外的隐式转换,从而减慢我的查询速度。
这是一个 64 位浮点数。
select datalength(5000E0)
产出
8
select 5000E0 val into #t
select t.name, t.max_length, t.precision
from tempdb.sys.columns c
join sys.types t
on t.system_type_id = c.system_type_id
where object_id = object_id('tempdb..#t')
产出
name max_length precision
--------- ---------- ---------
float 8 53