问题
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