• Borrowing on John's good data creation code and assuming the column is actually a VARCHAR instead of a char, here's a super simple way to take care of double, triple, or more words without having to know how many words there are...

    Declare @address table (address VARchar(50))

    insert into @address

    select 'Lincoln'

    union all

    select 'Kentucky Kentucky'

    union all

    select 'Walla Walla'

    union all

    select 'New York New York'

    union all

    select 'New York CITY New York CITY'

    union all

    select 'Ohio'

    union all

    select 'Iowa'

    SELECT CASE

    WHEN LEFT(Address,LEN(Address)/2)=RIGHT(Address,LEN(Address)/2)

    THEN LEFT(Address,LEN(Address)/2)

    ELSE Address

    END

    FROM @Address

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)