开发者

copy part of string from one column into another

I've got a column with some string data that somew开发者_C百科here has 'T##' (## being a two digit number) I want to copy this into another column, how do I do that?

something like this: abc-T03-def -> 03


For Microsoft SQL Server:

update YourTable
    set NewColumn = substring(OldColumn, patindex('%T[0-9][0-9]%', OldColumn) + 1, 2)
    where patindex('%T[0-9][0-9]%', OldColumn) <> 0
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜