If I just write something like
select 10.00;
What type does this give me?
Here's a test I ran, to test the binary representation of these types. The big surprise here is that none of the casts actually match the first row!
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
Can anyone explain this?
Originally, all I wanted to do was avoid having to write the cast statement, assuming 123.866 was implicitly a decimal. So I thought to test if these two statements were the same:
select cast(123.866 as decimal)
select 123.866