Home > front end >  Invalid type for substring function
Invalid type for substring function

Time:09-21

I have a message error

Invalid int argument data type for substring function argument 1.

I don't understand why!

UPDATE DBO.NUMBER
SET NUMBER = 22675442455
WHERE SUBSTRING(ID,1,2) NOT IN ('67','68')

CodePudding user response:

SUBSTRING required first argument as STRING, so simply convert it to VARCHAR.

UPDATE DBO.NUMBER
SET NUMBER = 22675442455
WHERE SUBSTRING(CONVERT(VARCHAR(15),ID)),1,2) NOT IN ('67','68') 
  • Related