I have a table with a column LIST_OF_NUMBERS containing the following strings:
10, 20, 395, 443, 534, 734, 954, 105, 156
I want to truncate the LIST_OF_NUMBERS column to 10 characters as follows:
LEFT(LIST_OF_NUMBERS,10)
10, 20, 39
However, if a number from the list of string is partially truncated I want to truncate the whole number instead. For example in my case I do not want to display 39 as it's misinterpreting. I want to truncate the whole number as follows:
10, 20,
I believe it can be achieved with the following condition:
If the string does not ends with comma, truncate the strings until it ends with a comma.
How can I translate this condition in SQLScript?
Note that I am novice on creating store procedure.