Argument data type numeric is invalid for argument 1 of substring function

会有一股神秘感。 提交于 2021-02-16 18:01:52

问题


I get the following message with this code

case when substring(New_Limit,11,1)=' ' then '0'+substring(New_Limit,1,10)

The 'then' bit is meant to concat the 0 and substring. Any help?


回答1:


This means that your New_Limit variable is a numeric value. You may want to put a CAST to (n)varchar around it.




回答2:


You try to cast it to a string type (varchar) first:

SUBSTRING(CAST(New_Limit AS varchar(38)), 11, 1)


来源:https://stackoverflow.com/questions/13647370/argument-data-type-numeric-is-invalid-for-argument-1-of-substring-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!