在数字前用零填充以使其长度相同 [英] Padding with zero before number to make it same length

查看:82
本文介绍了在数字前用零填充以使其长度相同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



我有一个字段item_code字符变化(40)我的id有1,2,21,112等



现在我想加零,将1位和2位数代码设为3位数。



请告诉我该怎么做。

Hi all

I have a field item_code charecter varying(40) where i have id's like 1,2,21,112 etc

Now i want to add zero to make the 1 and 2 digits code to 3 digit.

Please tell me how to do that.

推荐答案

尝试在此处找到您的解决方案:功能 - 格式化 - 示例 - 表格 [ ^ ]



+++++++++++++ +++++++++++++++++++++++++++++++++++ =http://sqlfiddle.com/#!15/45148/5> http://sqlfiddle.com/#!15/45148/5 [ ^ ]



我花了很多时间就此而言。请记得接受解决方案并投票。
Try to find your solution here: FUNCTIONS-FORMATTING-EXAMPLES-TABLE[^]

+++++++++++++++++++++++++++++
Seeing is believing.
See for yourself my example here: http://sqlfiddle.com/#!15/45148/5[^]

I have spent much time on this. Do remember to accept the solution and vote.


这篇关于在数字前用零填充以使其长度相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆