SQL Server - Removing (1) from Device Names on the Dashboard

SQL Server - Removing (1) from Device Names on the Dashboard

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)'

___________________________________________________________________________________________________

    • Related Articles

    • SQL Server - Removing a Black Box (Offline) Device from the Dashboard

      If a device is offline (server can't communicate with it) for more than 15 minutes its icon will turn into a black box with a white question mark inside. If this device is from a Device Gateway that has been improperly decommissioned you can remove ...
    • SQL Server - Manual Device Deletion

      If you need to remove a device from the dashboard and it is not possible to use the Delete button on the Administration > Devices page, you can do it through SQL Management Studio. Marking a Device as Deleted In Management Studio run the following ...
    • SQL Server - Resetting the Dashboard Admin User Password

      If the Admin user password is changed from default and lost you can reset it through SQL server. Reset Admin password to EE dashboard login 1) Open SQL Management Studio and run the following query. select * from eg.sysuser, 2) Look for the ...
    • SQL Server - Deleting Alarm State to Clear False Alarms from the Dashboard

      Occasionally, the alarm status on the dashboard will miss a clear event and it is necessary to delete the alarm state from the database in order to fix the problem. The following procedure steps through this event. Removing an alarm state from the DB ...
    • SQL Server - Query for Generating Device, Point and Alarm List

      The SQL query for generating a device, point, and alarm list is as follows: SELECT TAG.LABEL AS URL , D.NAME AS DEVICE , P.NAME AS POINT , ISNULL(E.DESCR,'') AS ALARM FROM EG.POINT AS P JOIN EG.DEVICE AS D ON P.OBJ_ID = D.DEVICE_ID JOIN EG.CONT_ADDR ...