String search and replace it with single letter

  • Hello All,

    Is it possible to find out rows with repeating letters in a word using TSQL, if not what is the best approach ?

    for example naame and name .. so it should give me row with naame as "aa" is repeated in it.

    create table testing (id int identity(1,1), name varchar(20))

    insert into testing values ( 'name')

    insert into testing values ( 'nname')

    insert into testing values ( 'naame')

    insert into testing values ( 'naamme')

    insert into testing values ( 'nnamee')

    insert into testing values ( 'sqlserver')

    insert into testing values ( 'sqqlservver')

    I need to find that row and replace the repeting letter with single letter.

    **** Somehow it gets posted twice... Moderators please delete one .. not sure why it happens

    Thanks

    ______________________________________________________________________________________________________________________________________________________________________________________
    HTH !
    Kin
    MCTS : 2005, 2008
    Active SQL Server Community Contributor 🙂

  • Ironic that in a post about removing duplicates ....

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Do you mean any row with a repeating letter? What about "letter" itself? It's a valid repetition.

  • Steve Jones - SSC Editor (3/9/2011)


    Do you mean any row with a repeating letter? What about "letter" itself? It's a valid repetition.

    Thanks Steve for asking, I have it on http://www.sqlservercentral.com/Forums/Topic1075800-146-1.aspx

    somehow it posts double when I try to post ... is it a problem with my browser ? I tried clearing all cookies and cache as well .. but no luck ..

    sorry for double post 🙂

    ______________________________________________________________________________________________________________________________________________________________________________________
    HTH !
    Kin
    MCTS : 2005, 2008
    Active SQL Server Community Contributor 🙂

  • No worries, I'll close this one.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply