我如何在SQL服务器中编写
如果数字不是前导0并且总长度为9或10,则理想情况下在select语句中添加0到数字
我有这样的事情,有人可以帮助纠正这个
select
[mobile]
from tab
WHERE
( RIGHT ('0' + ([mobile] (1)), 1)
AND LEN([mobile]) IN (9, 10))
不太确定你想要什么,但这里是我在黑暗中的镜头。
select NewMobile = case when mobile not like '0%' and LEN(mobile) IN (9, 10) then '0' else '' end + mobile
from tab