在 SQL 服务器中,我有 VARCHAR 值。
我需要一个自动重新格式化数据的视图。
以以下形式存储的数据:
hawthorn104freddy@hawthorn.com
scotland2samantha@gmail.com3
birmingham76roger@outlook.co.uk1905student
需要重新格式化为以下内容:
hawthorn 104freddy@hawthorn.com0000
scotland 002samantha@gmail.com 0003
birmingham076roger@outlook.co.uk1905student
重新格式化
- 字符串中的数值用零填充到最长数字的长度
- 所有其他字符都用空格字符填充以排列数字。
有谁知道这是怎么做到的?
注意:请记住,字符串可以包含单词和数字的任意组合。