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 2005 Forums
 Transact-SQL (2005)
 Float To Varchar issues...

Author  Topic 

chrpeter
Starting Member

31 Posts

Posted - 2008-08-06 : 11:30:12
I'm trying to populate one table(Table B) with data from another table .
(Table A).

Table A has an Float column
Table B has a varchar(20) column.

I've tried CAST and CONVERT, and both give the same results.

cast(cust_po AS varchar(20))
convert(varchar(20), custpo)
Both turn 56090000 into 5.609e+007

I've also tried modifying the source table and changing the column to a varchar, and had the same results.

Any ideas?






chrpeter
Starting Member

31 Posts

Posted - 2008-08-06 : 11:33:46
Nevermind I figured it out

I cast it as a decimal with 0 decimal places then to varchar.

CAST(CAST(b.cust_po AS decimal(20,0)) as varchar(20))
Go to Top of Page
   

- Advertisement -