Assets - Duplicate names
- Last UpdatedFeb 15, 2023
- 2 minute read
Provides a list of duplicate Assets in all the Plants.
This script will list out multiple instances of the assets within a Plant having identical Asset Name and type (i.e. location or equipment). However, the Primary key of these assets will be different. Such assets are called ‘duplicate asset’.
For example, consider that Plant A has three assets with similar Asset Name ‘Boiler’ and all the three are of type ‘Equipment’. However, the Primary Key of all the three assets are different. Then, when you run the script, it will list all the three occurrences of the asset ‘Boiler’ for Plant A.
Resolution:
After the upgrade, you may have to manually run the FixDuplicateAssetReferences.sql script available at '..DBIntegrity/SqlScripts' folder. After running this script, you will have to manually delete the duplicate assets via the Management Center.
Note: Depending upon the number of duplicate assets you have, the script might take a longer time to complete. It is recommended to take a back up of your database before running the script.
When you run this script, then from the list of duplicate assets, for each unique asset name in a Plant, it will search for the asset having maximum references in the following tables. It will then update the foreign keys of the assets having lesser references in tables and set it to the Primary Key of the asset having maximum references. The Primary Key of the other duplicate assets having less references, will no longer appear as a foreign key in any of the tables.
-
ISMGT_LOG
-
ISMGT_GROUP
-
ISMGT_ITEM
-
SAT_TRANS_DATA_GROUP
-
SAT_TRANS_DATA_ITEM
-
SAT_WOR_RequestItems
-
SAT_Active_FIDs
When the script completes, it suffixes the value ‘<assetname>_old_x’ to the other assets in the duplicate asset list, where ‘x’ is the number of the duplicate occurrence. You will have to manually delete these assets via the Management Center.
Note: The rows in the tables that were updated by the script will display the Last Modified By as ‘System User’.