Home Forums SQL Server 2012 SQL Server 2012 - T-SQL How to find repetitive strings in a column and then remove the second string RE: How to find repetitive strings in a column and then remove the second string

  • Here's another option. It considers that the address can be identified by the first 8 characters. You can adjust that value.

    SELECT *, LEFT( a.address, CHARINDEX( LEFT( a.address, 8), a.address, 2) - 1)

    --UPDATE a SET address = New_Address

    FROM address_fix a;

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2