我有这样的某种模式的原始col:
myWord xxxx xxxxxx xxxxxx xxxxxx
我会这样提取myWord
和更改:
myNewWord xxxx xxxxxx xxxxxx xxxxxx.
通过搜索第一个空格(' '
)来搜索第一个单词。然后使用分割字符串RIGHT
并将其连接到'myNewWord'
:
WITH Tbl(col) AS(
SELECT 'myWord xxxx xxxxxx xxxxxx xxxxxx' UNION ALL
SELECT 'first xxxx xxxxxx xxxxxx xxxxxx' UNION ALL
SELECT 'sample xxxx xxxxxx xxxxxx xxxxxx'
)
SELECT *,
NewCol = 'myNewWord' + RIGHT(col, LEN(col) - CHARINDEX(' ', col) +1)
FROM Tbl
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句