If a duplicate name occurs on one of the Device Gateways the SQL server will add (1) to the end of the name to distinguish it from the original. Once the duplicate naming issue is solved you may want to remove the (1) from the end of the device name.
In SQL Management Studio:
---------------------------------------------------------------------------------------------
Step 1:
Look for devices with a (1) or (2)
select * from eg.device where name like '%(1)%' and name not like '%(Deleted)%'
Save the list of devices if any (example device: J07UPS02(1))
---------------------------------------------------------------------------------------------
Step 2:
Now check for devices with the same root name (from list)
select * from eg.device where name like '%J07UPS02%' and name not like '%(Deleted)%'
If you see a device that has the root name (like J07UPS02) and a device like J07UPS02(1), you will need to perform step 3
If you don't see any devices with just the root name, proceed to step 5
---------------------------------------------------------------------------------------------
Step 3: (if needed)
Check to make sure there are no active points on the device with this name (change name in last line - no ( ) )
SELECT distinct T.NAME AS groupName
-- ,T.TREE_ID AS groupId
,DP.DEVICE_NAME AS deviceName
,DP.DEVICE_ID AS deviceId
-- ,DP.POINT_NAME AS pointName
-- ,DP.POINT_ID AS pointId
-- ,DP.UOM_ABBREV AS uom
-- ,TLR.DTS AS dts
-- ,TLR.TS_VAL AS val
FROM EG.V_DEVICE_POINT AS DP
INNER JOIN EG.NODE N
ON N.CHILD_ID = DP.DEVICE_ID
INNER JOIN EG.TREE T
ON T.TREE_ID = N.PARENT_ID
JOIN EG.TSV_LAST_REPORTED AS TLR
ON DP.POINT_ID = TLR.POINT_ID
WHERE DP.DEVICE_ID NOT IN (
SELECT PROP_VAL_OBJ_ID
FROM EG.V_PROP_VAL
WHERE PROP_CODE = 'DELETED'
AND PROP_VAL = '1'
)
AND DP.POINT_ID NOT IN (
SELECT PROP_VAL_OBJ_ID
FROM EG.V_PROP_VAL
WHERE PROP_CODE = 'DELETED'
AND PROP_VAL = '1'
)
AND DP.UOM_ABBREV != 'DIGITAL'
AND ((dp.device_name LIKE '%J07UPS02%'))
----------------------------------------------------------------------------------------------
Step 4 (mark unused device as deleted)
If you saw a device without perenthesis in step 3, stop and contact tech support.
If you only saw the device with perenthesis in step 3 proceed:
update eg.DEVICE set name='J07UPS02(DELETED)' where NAME ='J07UPS02'
----------------------------------------------------------------------------------------------
Step 5 (rename point with perenthesis to point without perenthesis)
update eg.DEVICE set name='J07UPS02' where NAME ='J07UPS02(1)'
___________________________________________________________________________________________________