I would like to delete all values in a column 'F250N' of type string between a known char ']' and an expression '[G56]' in Table 'T250'
This would also need to cover cases where a preceding char of ] cannot be found eg. at the start of the string.
Eg:
SYSADMIN[G63]Z-GHQ[G62]Z-WE[G56]Z-MEX[G56]Z-NAZ[G56]Z-LAS[G56]Z-LAN[G56]Z-CEE[G56]Z-APAC[G56]Z-CAD[G56]
Would become:
SYSADMIN[G63]Z-GHQ[G62]
and:
LVN-CHNG[G62]LVN-READ[G56]LVN-FULL[G63]
Would become:
LVN-CHNG[G62]LVN-FULL[G63]
So far I have tried something like:
update T250
set F250N = replace(F250N, '[G56]', '')
from T250
however this does not take into account the portion of the string preceding [G56]
to the last ]