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)
 Add Zeros a the end of value?

Author  Topic 

sqldba20
Posting Yak Master

183 Posts

Posted - 2010-03-05 : 14:34:28
Folks:

I have this float values in one of the columns of a table:

89.6456
60.11162
0.51158
0.267
98.889900


I want to select the float values and then add Zero '0' at the end. The total character should not exceed ten (10). Here is the output should look like: How can I do that in a select statement?

89.6456000
60.1116200
0.51158000
0.26700000
98.8899000


Thanks !

sqldba20
Posting Yak Master

183 Posts

Posted - 2010-03-05 : 14:49:01
Nevermind.. I got it....


LEFT(CONVERT(VARCHAR,COLUMNNAME)+'0000000000', 10)


Thanks !
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-03-05 : 15:07:29
What's wrong with STR function?

SELECT STR(0.267, 10, 8)
SELECT STR(89.6456, 10, 8)




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

- Advertisement -