I Want to Delete Duplicate Records from Table

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2017 02:25 AM
Using load data, i had loaded 800 records in my sys_choice table.
Again i had loaded the file having 100 records.
But that 100 records already inserted during import of 800 records.
so know i have total 900 records in which 100 are duplicate records.
and i want to delete those 100 duplicate records.
please anyone having solution for this.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2017
03:02 AM
- last edited on
‎07-12-2024
02:31 PM
by
ServiceNow
You can use background script to delete multiple records.
just have to built logic to find duplicates.
you will find the below links helpful
Useful User Scripts - ServiceNow Wiki
Delete multiple records using background scripts
Thanks
Neeraj Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2021 04:53 AM
Hi Ankur,
Your Script is working completely fine and does the job.
Thanks for sharing!
Sai Krishna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2022 08:39 PM
I have a similar requirement on the variable table (item _option_new) , here my script is generating duplicate variables with the same backend name i.e. field "name". I want to delete those duplicate variables. But catch here is , these variables are for respective catalog items, so duplicate variables should be removed from each catalog item. i.e. that respective variable should be present only once in each catalog item.
So, the requirement is , i need to remove duplicate variables from the catalog item. But the same variable with the same name can exists in another catalog item.
Exampple
here , in the catalog item "change lease" the variable page_general_1 is repeated twice is duplicated and i want to remove those duplicates from this catalog item but that variable may exisits in someother catalog item.
Please help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2017 09:25 AM
Hi Nitesh,
I don't think deleting 100 records is a big deal and you don't want to write a script for it.
Go to https://instancename.service-now.com/sys_choice_list.do (replace instance name with your instance name), sort by created by, apply the required filters, and select the records you want to delete using the check boxes on the left and delete.
Hope this helps. Mark the answer as correct/helpful based on impact.
Thanks
Antin