I have the following code in an SQL update statement. If the string is lees tahn 2000 charactors I get an error. What syntax can I use to keep the string under 2000 and at the same time not cause an error?
posted 9 years ago
You need to check the length of the string so that the second argument of substring is either the max length of the string or 2000 which ever is the smaller eg:
Note: this will still fail if 'signhist' is null so you may need to also check for that