SQL sql查询中的十进制格式
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9696496/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 14:50:17 来源:igfitidea点击:
decimal formatting in sql query
提问by Vicky
I have a query as below:
我有一个查询如下:
Select price from myTable;
This returns value '22.50'
这返回值 '22.50'
However, I need the format as 5.8 bytes
in my program.
但是,我需要程序中的格式5.8 bytes
。
That is my String value should be '00022.50000000'
and not '22.50'
那是我的 String 值应该是'00022.50000000'
而不是'22.50'
Is there a way to achieve this directly in SQL ?
有没有办法直接在 SQL 中实现?