Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8755567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:52:58+00:00 2026-06-13T13:52:58+00:00

I have a poorly maintained database that includes employee information. Human Resources requested a

  • 0

I have a poorly maintained database that includes employee information. Human Resources requested a report that lists instances where the employee name associated with an insurance coverage does not match the name on the insurance policy.

There are inconsistencies in the formatting of the names in both tables. It’s always last name then first name, but you might see any of the following in either table for a fictional employee named Steven J. Smith:

  1. Smith, Steven
  2. Smith,Steven
  3. Smith, Steven J.
  4. Smith,Steven J.

I need to run a query looking for instances where EMPLOYEE.EMP_NAME <> INSURANCE.SUBSCRIBER_NAME while allowing for differences in name formatting as shown above (i.e. picking up that “Smith,Steven J.” and “Smith, Steven” are (probably) the same person and igonring them).

SELECT 
  EMPLOYEE.EMP_NO
, EMPLOYEE.EMP_NAME
, INSURANCE.SUBSCRIBER_NAME
, INSURANCE.PAYOR_NAME

FROM EMPLOYEE
     INNER JOIN INSURANCE ON EMPLOYEE.EMP_NO = INSURANCE.EMP_NO

WHERE EMPLOYEE.EMP_NAME <> INSURANCE.SUBSCRIBER_NAME

I know I want to do a substring to ignore the middle initial, but how do I account for ignoring whether or not there is a space after the comma?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:52:59+00:00Added an answer on June 13, 2026 at 1:52 pm

    Thanks, your answers helped a lot. I ended up cutting the name into [lastname][firstname] with no spaces and cutting off the middle initial if it was there. Here’s what eventually worked in eliminating the vast majority of the same-name matches:

    ((CASE
    WHEN CHARINDEX(' ',REPLACE(REPLACE(EMPLOYEE.EMP_NAME,', ',''),',','')) = 0
    THEN UPPER(REPLACE(REPLACE(EMPLOYEE.EMP_NAME,', ',''),',',''))
    ELSE UPPER(LEFT(REPLACE(REPLACE(EMPLOYEE.EMP_NAME,', ',''),',',''),CHARINDEX(' ',REPLACE(REPLACE(EMPLOYEE.EMP_NAME,', ',''),',',''))))
    END) <> 
    (CASE
    WHEN CHARINDEX(' ',REPLACE(REPLACE(INSURANCE.SUBSCRIBER_NAME
    ,', ',''),',','')) = 0
    THEN UPPER(REPLACE(REPLACE(INSURANCE.SUBSCRIBER_NAME
    ,', ',''),',',''))
    ELSE UPPER(LEFT(REPLACE(REPLACE(INSURANCE.SUBSCRIBER_NAME
    ,', ',''),',',''),CHARINDEX(' ',REPLACE(REPLACE(INSURANCE.SUBSCRIBER_NAME
    ,', ',''),',',''))))
    END))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've decided to rewrite a database I have that is poorly normalized. I've created
I have a huge database that has lots and lots of poorly documented constraints.
I have a database that tracks the location of inventory. The application was poorly
I have to connect to a poorly implemented server that only understands Content-Type (capital-T)
Essentially I have to use a poorly implemented web service maintained by other programmers.
I have a C# program that I poorly named when I first started it
I basically have a lot of poorly designed code to do something that, I'm
I noticed that many websites, even Google and some banking sites, have poorly-written HTML
I have a poorly designed table that I did not design and cannot fix/change
We have had an issue with a block of code that responds poorly in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.