Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
你说长度必须是4,并且右边的0被修剪掉了。因此在右侧添加 4 个 0,并取左侧 4 个字符:
SELECT left(concat(cast(digits as varchar(10)), "0000"), 4) as digits
You say the length has to be 4, and the 0's to the right were trimmed. So add 4 0's to the right, and take the left 4 characters:
如果您想将随机数字附加到“数字”列中的所有值,您可以这样做:
UPDATE TblName SET Digits = CAST(CAST(Digits AS VARCHAR) + '0' AS INT)
并且您可以将“0”替换为您想要附加的任何数字?
If you want to append a random digit to all the values in column Digits, you could do :
And you can replace '0' with whatever digit you want to append?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(2)
你说长度必须是4,并且右边的0被修剪掉了。因此在右侧添加 4 个 0,并取左侧 4 个字符:
You say the length has to be 4, and the 0's to the right were trimmed. So add 4 0's to the right, and take the left 4 characters:
如果您想将随机数字附加到“数字”列中的所有值,您可以这样做:
并且您可以将“0”替换为您想要附加的任何数字?
If you want to append a random digit to all the values in column Digits, you could do :
And you can replace '0' with whatever digit you want to append?