简体   繁体   English

删除资金小数查询并填充零SQL选择

[英]Remove Money Decimal Query and pad zeros SQL Select

I am looking for some guidance. 我正在寻找一些指导。 I am running a select on a wage where I need the results to remove the decimal and pad zeros to the end. 我正在对工资进行选择,我需要结果除去小数点并将零填充到最后。

isnull(rtrim(convert(char(11), c2.wage)), space(11)) as 'DN62', 

In the example above I am pulling 1384.61 but need to result to 13846100000. 在上面的示例中,我提取了1384.61,但需要将结果提高到13846100000。

Thanks in advance. 提前致谢。

I assume that you are using SQL Server. 我假设您正在使用SQL Server。 The following would work for you: 以下将为您工作:

SELECT LEFT(REPLACE(Cast(ISNULL(1384.61,0) as varchar), '.', '') + '0000000000',11)

Another way is to multiply your number for the required zeros. 另一种方法是将您的数字乘以所需的零。 Use one of these solutions as per your situation. 根据您的情况使用这些解决方案之一。 Hope it helps :) 希望能帮助到你 :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM