SQL Name Search Help.

  • Ex:
    Table 1 Contains Full name and below is example of data
    Full_Name
    Robert D Master
    John Cic MD
    Ravi, Ramesh
    Rajesh, Kumar.

    Table 2 Contains First name  and Last name and below is example of data
    First_Name Last_Name
    Robert         Master
    John             Cic
    Ravi              Ramesh
    Rajesh          Kumar

    The issue is table one contains 300 records and Table2 contains around 4 million records .
    and Data is not in sync between two tables ( We have created functions to remove special characters and titles also) and there are many permutations and combinations need to do compare data. Due to functions / strings query is two, is there any way we can accomplish this. Any help appreciated. Thanks!

  • If I understand you correctly, after you run the full name from table 1 through your function you would have the following
    Full_Name
    Robert D Master
    John Cic
    Ravi Ramesh
    Rajesh Kumar
    If that is the case the following would give you first and last name only (i.e. Robert D Master would be Robert Master)
    Select Left(@FullName, Charindex(' ', @FullName) - 1) + ' ' + Right(@FullName, CharIndex(' ', Reverse(@FullName))-1)
    Is this what you are looking for.
    Note: You may have more than one Robert Master in your Table 2 and you might need to find something else that is unique.

Viewing 2 posts - 1 through 1 (of 1 total)

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