Reply to Re: float vs decimal

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация