Skip to page contentSkip to chat
ServiceNow support
    • Community
      Ask questions, give advice, and connect with fellow ServiceNow professionals.
      Developer
      Build, test, and deploy applications
      Documentation
      Find detailed information about ServiceNow products, apps, features, and releases.
      Impact
      Accelerate ROI and amplify your expertise.
      Learning
      Build skills with instructor-led and online training.
      Partner
      Grow your business with promotions, news, and marketing tools
      ServiceNow
      Learn about ServiceNow products & solutions.
      Store
      Download certified apps and integrations that complement ServiceNow.
      Support
      Manage your instances, access self-help, and get technical support.
Duplicate user records in sys_user table - Support and Troubleshooting
  • >
  • Knowledge Base
  • >
  • Support and Troubleshooting (Knowledge Base)
  • >
  • Duplicate user records in sys_user table
KB0760025

Duplicate user records in sys_user table


4496 Views Last updated : Jan 28, 2024 public Copy Permalink
KB Summary by Now Assist

Issue

Customer was able to create multiple records with the same 'User ID'. 

Cause

There is no unique index on sys_user.user_name

Resolution

If the issue is identified in production, it is recommended to take clone of the production to sub-prod and follow the steps in sub-prod first

  1. Identify and remove all the duplicate records from the sys_user table
  2. Check the count on the sys_user table 
  3. Create Unique index on the sys_user table on the user-id field. Below is the procedure
    1. Navigate to System Definition > Tables.
    2. In the list, find the table you want and click its label.
    3. Navigate to the Database Indexes related list.
    4. Click New.
    5. Use the slushbucket to select the fields you want included in the index.
      The order in which you select the fields affects how the index works. If you do not have expertise in database design, you should consult someone who does.
    6. To create a unique index, check the Unique Index box.
    7. Click Create Index
  4. If there are any duplicate records exists, system may not create Unique Index on the table. 
  5. Check the count on the sys_user table. 

 

After creating the unique index, try to create multiple records with the same User Id, following error will occur. 

"Unique Key violation detected by database (Duplicate entry '1234' for key 'user_name')"
"Invalid insert"

 

This means, Unique index creation on User Id is successful. 

Related Links

https://docs.servicenow.com/csh?topicname=t_CreateCustomIndex.html&version=latest

 


The world works with ServiceNow.

Sign in for more! There's more content available only to authenticated users Sign in for more!
Did this KB article help you?
Did this KB article help you?

How would you rate your Now Support digital experience?

*

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

What can we improve? Please select all that apply.

What are we doing well? Please select all that apply.

Tell us more

*

Do you expect a response from this feedback?

  • Terms and conditions
  • Privacy statement
  • GDPR
  • Cookie policy
  • © 2025 ServiceNow. All rights reserved.