From: Dan on

"Erland Sommarskog" <esquel(a)sommarskog.se> wrote in message
news:Xns9DC4AF0ECFB63Yazorman(a)127.0.0.1...
> Scott Morris (bogus(a)bogus.com) writes:
>> The answer is very simple and not a bug. What is the datatype of
>> 9.990000? The following will tell you.
>>
>> select 9.99000 as xx into testtb
>> exec sp_help 'testtb'
>
> An alternate way to find the same information is this:
>
> declare @x sql_variant
> select @x = 9.990000
> select sql_variant_property(@x, 'Basetype'),
> sql_variant_property(@x, 'Precision'),
> sql_variant_property(@x, 'Scale')
>
>
> More to type, but creates no table.
>
>> The moral: If you use literals you must know what datatype the database
>> engine uses to represent that value. Alternatively, specify the
>> datatype so there is no possibility of guessing.
>
> What is the datatype of a literal in SQL Server is definitely an trivial
> thing, and there is more then one situation where results are not as
> expected. What about this:
>
> select power(10.0, -2), power(10.00, -2)
>
> And, Dan... ISQL uses DB-library connects with ARITHABORT and
> ANSI_WARNINGS
> ON, so it lets you get away with it.

I thought there might have been something in the connection properties which
is why I mentioned it.

--
Dan