Skip to content
Advertisement

Adding hyphen in a column in sql table

I need help understanding how to add a hyphen to a column where the values are as follows, 8601881, 9700800,2170

The hyphen is supposed to be just before the last digit. There are multiple such values in the column and the length of numbers could be 5,6 or more but the hyphen has to be before the last digit.

Any help is greatly appreciated.

The expected output should be as follows, 860188-1,970080-0,217-0

Advertisement

Answer

Here is the full example:

In case OP meant there can be multiple numbers in the column value here is the solution:

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement