更新表集Test = Convert(varchar(53),Cast(Phone_Number as Decimal))
答案 0 :(得分:3)
如果Phone_Number有任何字母或符号字符,则在将其播放到DECIMAL时会失败:
Update table set Test = Convert(varchar(53), Cast(Phone_Number as Decimal))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
你的问题很模糊,但你可以尝试:
Update YourTable
SET Test=CASE
WHEN ISNUMERIC(Phone_Number)=1 THEN Convert(varchar(53), Cast(Phone_Number as Decimal)) --this is your code unchanged
ELSE Phone_Number
END
...