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
 Add Trailing Zeros

Author  Topic 

Vack
Aged Yak Warrior

530 Posts

Posted - 2014-03-21 : 09:19:03
I'm creating a view and in my select statement I need to add trailing zeros.

Field is a cost field. May have values like:
2
1.2
1.24
0.883

I need those to be:
2.000000
1.200000
1.240000
0.883000

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2014-03-21 : 10:59:20
use convert to numeric --> Convert(numeric(7,6),Field/Calculation),

select convert(numeric(7,6),1.2) --If there is always one digit to the left of decimal with the precision upto six digits, else adjust the numeric(n,n) as required.

Cheers
MIK
Go to Top of Page
   

- Advertisement -