在数字前用零填充以使其长度相同

问题描述:

大家好



我有一个字段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.