sql - copy part of string from one column into another -
i've got column string data somewhere has 't##' (## being 2 digit number) want copy column, how do that?
something this: abc-t03-def
-> 03
for microsoft sql server:
update yourtable set newcolumn = substring(oldcolumn, patindex('%t[0-9][0-9]%', oldcolumn) + 1, 2) patindex('%t[0-9][0-9]%', oldcolumn) <> 0
Comments
Post a Comment