In MS SQL Server I need to update a substring of data within a column based on a change to two parts of the string.
The column accountcode exists currently as:
0100-0001
I need to change this to
10-0004-9999-000006
The logic to this change is:
0100 changes to 10-0004-xxxx-000006
and 0001 changes to xx-xxxx-9999-xxxxxx
I can perform a replace command to change the second 'segment' in the column first, as this is unique. How would I then go about changing the rest of the string around it?
The column accountcode exists currently as:
0100-0001
I need to change this to
10-0004-9999-000006
The logic to this change is:
0100 changes to 10-0004-xxxx-000006
and 0001 changes to xx-xxxx-9999-xxxxxx
I can perform a replace command to change the second 'segment' in the column first, as this is unique. How would I then go about changing the rest of the string around it?
Comment