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
 General SQL Server Forums
 New to SQL Server Programming
 mathematical query

Author  Topic 

renu
Starting Member

47 Posts

Posted - 2007-09-28 : 02:58:59
how to round the exponential values.

for example my input is 8.14444367893246e-4

my expected output should be 8.14444367893246

how to achieve this?

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-09-28 : 03:07:55
quote:
Originally posted by renu

how to round the exponential values.

for example my input is 8.14444367893246e-4

my expected output should be 8.14444367893246

how to achieve this?



What is the logic behind this?
Do you want to omit exponential part from the input?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Koji Matsumura
Posting Yak Master

141 Posts

Posted - 2007-09-28 : 03:10:54
Why not 0.000814444367893246?
Go to Top of Page

renu
Starting Member

47 Posts

Posted - 2007-09-28 : 03:12:14
yes i want to remove the exponential part alone rest values should be the same
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-09-28 : 03:17:50
quote:
Originally posted by renu

yes i want to remove the exponential part alone rest values should be the same


No Logic?


declare @s varchar(50)
set @s='8.14444367893246e-4'
select @s,left(@s,charindex('e',@s)-1)


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-09-28 : 03:35:49
You need to convert it to scientific first for all cases, or
0.814444367893246 and 8.14444367893246 will fail.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-09-28 : 04:08:27
quote:
Originally posted by Peso

You need to convert it to scientific first for all cases, or
0.814444367893246 and 8.14444367893246 will fail.



E 12°55'05.25"
N 56°04'39.16"



Yes it is. But Still I dont understand why OP wants omission instead of conversion

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

renu
Starting Member

47 Posts

Posted - 2007-09-28 : 04:33:31
i have to execute set of function in sql .in that in a paricular part i have to perform thos calculation.2/2500 the result set wil be 0 generally. but in scientific method i should get the output as 8.13333333333e-4(its just an example value).but my output should be 8.13333333333 alone.do u got the scenario.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-09-28 : 04:40:21
2/2500 is .000800


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-09-28 : 04:54:13
How to convert 81.3333333333?
81.3333333333 in scientific notation equals 8.13333333333e1



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

renu
Starting Member

47 Posts

Posted - 2007-09-28 : 04:56:18
ok let it be as 2/2456..
Go to Top of Page
   

- Advertisement -