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
 SQL Server Administration (2005)
 I need 2 decimal digits

Author  Topic 

hirani_prashant
Yak Posting Veteran

93 Posts

Posted - 2008-04-14 : 05:10:50
Hello All,

Current Format :-
40.3 49.4 62.8 75.5 89.2 100 112 127


Required Format
40.30 49.40 62.80 75.50 89.20 100.00 112.00 127.00


Currently mine above row data type is float. i need two points after precisions.

Thanks




SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-04-14 : 05:12:00
Use CAST. For more information read Books Online "Cast & convert".



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

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-04-14 : 05:12:46
If possible change data type from float to numeric or decimal, else use cast/convert.

Select cast(col as numeric(10,2)) as col from table


by mere 46 secs.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-04-14 : 05:17:35
Here is why Harsh suggested you to change the data type from float

declare @f float
set @f=40.3
select @f,@f*1


Madhivanan

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

- Advertisement -