Click here to Skip to main content
15,314,594 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hey in the address column there are duplicates value
e.g Alak Jyot chs flat no 1101 Alak Jyot chs flat no 1101
--Need output as Alak Jyot chs flat no 1101.
-- There are 1000 Plus records like this in address column
Can you please help ?

What I have tried:

--Don't know about this
can you help
thanks in advance
Posted
Updated 15-May-18 5:45am
Comments
Richard MacCutchan 15-May-18 11:10am
   
How did the information get there in the first place?
Member 13138564 15-May-18 11:16am
   
I am getting this file from from client where address has duplicates value.
Richard MacCutchan 15-May-18 11:28am
   
Then you need to go back to the client and explain that they have a problem in their data.
Member 13138564 15-May-18 12:15pm
   
Yes you are correct Richard but there should be a solution for this problem.
After solving this i can raise this issue to them.

1 solution

Do it in your presentation language:
Read all rows - check each row, and see if it's a duplicate:
C#
private bool IsDoubled(string s)
    {
    int half = s.Length / 2;
    if (s.Length % 2 != 0)
        {
        half++;
        }
    for (int i = 0, j = half; j < s.Length; i++, j++)
        {
        if (s[i] != s[j]) return false;
        }
    return true;
    }
If it is, use Substring to halve it, and UPDATE the DB Row.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900