从SQL Server中的字符串中删除大写字母(至少2个字符)

瞎的

我在下面有一些示例数据,想删除所有至少2个字符的大写字母,或者可以说双大写字母。

HON MANI no St.Chom Chao Trapeang Thloeng Chaom Chau Dangkao 
LAY NA 35 st 70 Phum10 Boeng Salang Tuol Kouk Phnom Penh 
OK KEMEUN Ek Phnom , Battam Bang
CY VANN Rukkhak Kiri ,Battam Bang
LENG EUN , Korng Pisei , Kampong Speu
SEK HONG , Phnom Sruoch , Kampong Speu

我想得到以下没有名称的结果

no St.Chom Chao Trapeang Thloeng Chaom Chau Dangkao 
35 st 70 Phum10 Boeng Salang Tuol Kouk Phnom Penh 
Ek Phnom , Battam Bang
Rukkhak Kiri ,Battam Bang
,Korng Pisei , Kampong Speu
, Phnom Sruoch , Kampong Speu

任何想法,请。

松鼠

像这样的东西

; with data as
(
    select  line = 'HON MANI no St.Chom Chao Trapeang Thloeng Chaom Chau Dangkao'   union all 
    select  line = 'LAY NA 35 st 70 Phum10 Boeng Salang Tuol Kouk Phnom Penh '  union all
    select  line = 'OK KEMEUN Ek Phnom , Battam Bang'   union all
    select  line = 'CY VANN Rukkhak Kiri ,Battam Bang'  union all
    select  line = 'LENG EUN , Korng Pisei , Kampong Speu'  union all
    select  line = 'SEK HONG , Phnom Sruoch , Kampong Speu'
)
select  *,
        result = case   when    first_two_word = upper(first_two_word) 
                 then   replace(line, first_two_word, '')
                 else   line 
                 end 
from    data
        cross apply
        (
            select  first_two_word = left(line, charindex(' ', line, charindex(' ', line) + 1))
        ) w

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

Related 相关文章

热门标签

归档