Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 character string to number - sql server 2000

Author  Topic 

Freddie
Starting Member

29 Posts

Posted - 2006-05-09 : 09:53:16
Hello Everyone:

I have a character field with the following values (+0002192.24)
i created a new table with a field format as REAL and used the CAST function but here's the result: 8.4100001E-2

I've tried converting the field in all the numeric formats but it still displays the same value. Any way around this?


Thanks a lot!

nr
SQLTeam MVY

12543 Posts

Posted - 2006-05-09 : 10:11:42
select convert(decimal(18,6), myfld) from tbl

Your 8.4100001E-2 is just the default character conversion for the datatype.
Be careful - reasls are not exact which can cause problems.
try convert(real,2.1)


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Freddie
Starting Member

29 Posts

Posted - 2006-05-09 : 13:13:23
Thanks nr...works well in a cursor :)
Go to Top of Page
   

- Advertisement -