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)
 plu_num(float) to char

Author  Topic 

skybvi
Posting Yak Master

193 Posts

Posted - 2011-06-27 : 16:22:47
Hi,
I am changing the datatype from plu_num(float) to char (13) of a column of a table, when i successfully do it..
The values un that column change like from original 4400002280 to 4.4e+009
How can i remove the e values...i want to get full value..


Regards,
Sushant
DBA
West Indies

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2011-06-27 : 16:44:36
Why? Why would you want to change a float to a char datatype?
A common rule when designing a database application is to use proper datatype.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

skybvi
Posting Yak Master

193 Posts

Posted - 2011-06-27 : 16:49:45
actually both columns (in diff table) have same type of data for example
523458659 (just numbers)
I want to write a query which selects data with condition
column1=column2 ....
But now, its not matching as e comes ....
I dunno, y they created float at first place or char for those data...


Regards,
Sushant
DBA
West Indies
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2011-06-27 : 17:18:01
[code]select
New_plu_num = convert(char(13),convert(bigint,plu_num)),
a.*
from
( --Test Data
select plu_num = convert(float,4400002280)
) a[/code]
Results:
[code]New_plu_num plu_num
------------- -----------------------------------------------------
4400002280 4400002280.0 [/code]

CODO ERGO SUM
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2011-06-27 : 17:32:30
If you already have changed the datatype of column, there is NO way to convert it back and revert the loss of precision.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -