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

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -