I can't seem to get the following result to pad with leading zeroes in SQL Server 2008. Please note, AMT14
is of type varchar
, so this will take the AMT14
and cast is as a decimal
, so it can execute the SUM
function.
<<select right('0000000000000' + sum(cast(AMT14 as decimal(13,2))),13) from {table1}>>
Result: 656311.22
Desired Result: 00000656311.22