|
Posted by Erland Sommarskog on 11/22/06 11:21
(othellomy@yahoo.com) writes:
> select convert(float,'1.2334e+006')
> 1233400.0
>
> select convert(decimal(20,2),'1.2334e+006')
> Server: Msg 8114, Level 16, State 5, Line 1
> Error converting data type varchar to numeric.
>
> Is there any way around?
> Is there any set options? I tried arithabort or arithignore and they
> don't work.
1.2334e+006 is not a legal literal for decimal. You will have to convert
in two steps, first to float, then to decimal.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
[Back to original message]
|