如果我只是写了一些类似于这样的内容:
select 10.00;
这会给我哪种类型?
这是我进行的一个测试,用于测试这些类型的二进制表示。最大的惊喜在于没有一个转换实际匹配第一行!
select cast(123.866 as binary) union all
select cast(cast(123.866 as real) as binary) union all
select cast(cast(123.866 as float) as binary) union all
select cast(cast(123.866 as decimal) as binary) union all
select cast(cast(123.866 as numeric) as binary) union all
select cast(cast(123.866 as money) as binary) union all
select cast(cast(123.866 as smallmoney) as binary)
--------------
0x0000000000000000000000000000000000000000000006030001DAE30100
0x000000000000000000000000000000000000000000000000000042F7BB64
0x00000000000000000000000000000000000000000000405EF76C8B439581
0x00000000000000000000000000000000000000000000120000017C000000
0x00000000000000000000000000000000000000000000120000017C000000
0x00000000000000000000000000000000000000000000000000000012E684
0x00000000000000000000000000000000000000000000000000000012E684
有人能解释一下这个吗?
最初,我只是想避免编写转换语句,假设123.866隐式为十进制。所以我想测试这两个语句是否相同:
select cast(123.866 as decimal)
select 123.866