This is a discussion on Converting real to varchar - but not 'exponent' format within the Sybase forums, part of the Database Server Software category; --> create table #t (a real not null, b real not null) go insert into #t (a, b) values (1, ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| create table #t (a real not null, b real not null) go insert into #t (a, b) values (1, 10000.1) insert into #t (a, b) values (1, 1000.1) go select convert(varchar(255), a / b) from #t go This returns the two rows 9.9999000667594373e-05 .00099990004673600197 The trouble is the 'e-05' representation. I would like to convert a real to a varchar getting just digits and decimal point, in other words .000099999000667594373 .00099990004673600197 Is this possible? -- Ed Avis <ed@membled.com> |
| |||
| select substring (convert (char (23), convert (numeric (38, 36), (a / b))), 2, 22) from #t go "Ed Avis" <ed@membled.com> wrote in message news:l1oev04n82.fsf@budvar.future-i.net... > create table #t (a real not null, b real not null) > go > insert into #t (a, b) values (1, 10000.1) > insert into #t (a, b) values (1, 1000.1) > go > select convert(varchar(255), a / b) from #t > go > > This returns the two rows > > 9.9999000667594373e-05 > .00099990004673600197 > > The trouble is the 'e-05' representation. I would like to convert a > real to a varchar getting just digits and decimal point, in other > words > > .000099999000667594373 > .00099990004673600197 > > Is this possible? > > -- > Ed Avis <ed@membled.com> > |
| ||||
| Ed Avis <ed@membled.com> wrote in message news:<l1oev04n82.fsf@budvar.future-i.net>... > create table #t (a real not null, b real not null) > go > insert into #t (a, b) values (1, 10000.1) > insert into #t (a, b) values (1, 1000.1) > go > select convert(varchar(255), a / b) from #t > go > > This returns the two rows > > 9.9999000667594373e-05 > .00099990004673600197 > > The trouble is the 'e-05' representation. I would like to convert a > real to a varchar getting just digits and decimal point, in other > words > > .000099999000667594373 > .00099990004673600197 > > Is this possible? Use the STR() function, converting FLOAT to string is what it is made for. -bret |