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.
| Author |
Topic |
|
rahul_dba
Starting Member
1 Post |
Posted - 2010-02-15 : 16:49:10
|
In my database i need to calculate the power of 2 for every month at the start it was OK but suddenly i noticed that after few months the data will be store in exponential format.If i use "power(2,18)" then i will get the ANSWER = 1.04858e+006..But i want it in plain digits i am using nvarchar(4000).But not getting it right.The data is getting stored in exponential format and when i am using select query i am getting the data back in the same exponential format.I want to store it in plain digits format, and retrieve the data in same plain digits format or at least if storing is not possible but retrieval should be done as plain digits. plszzzzzzzzzzz hepl me rahul |
|
|
Bustaz Kool
Master Smack Fu Yak Hacker
1834 Posts |
Posted - 2010-02-15 : 19:54:20
|
| The POWER function returns a float which is an approximation of the number generated. When I run this query:select power(2, 18)I get the result of 262144. What is the data type of the column you are storing the data into?=======================================Few things are harder to put up with than the annoyance of a good example. (Mark Twain) |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-16 : 00:52:17
|
| why dont cast it to decimal or numeric as per your requirement giving suitable scale and precision?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|