Author Topic: Duplicate manufacturer  (Read 1018 times)

archived

  • Hello, I'm new here
  • Posts: 0
    • View Profile
Duplicate manufacturer
« on: March 14, 2006, 04:08:05 am »
When adding a new device I created a duplicate Manufacturer by error. How can I delete the duplicate entry?

archived

  • Hello, I'm new here
  • Posts: 0
    • View Profile
Duplicate manufacturer
« Reply #1 on: March 14, 2006, 03:59:35 pm »
You can delete it from database. Open a MySQL console or a MySQL client and run:
Code: newbielink:javascript:void(0); [nonactive]

use pluto_main;

SELECT PK_Manufacturer, Description FROM Manufacturer WHERE Description LIKE '%your_name_here%';


This will return the primary key of the records from database. Then delete the duplicate records using:
Code: newbielink:javascript:void(0); [nonactive]
DELETE FROM Manufacturer WHERE PK_Manufacturer=X;
with X the primary key returned by SELECT query.

Be aware that if that manufacturer is used as foreign key for a device template, for example, by deleting it you will have an invalid key which will cause sqlCVS, the tool who make database syncronization, to crash.
You can check this with a query like:
Code: newbielink:javascript:void(0); [nonactive]
SELECT * FROM DeviceTemplate WHERE FK_Manufacturer=X;

archived

  • Hello, I'm new here
  • Posts: 0
    • View Profile
Thanks
« Reply #2 on: March 15, 2006, 12:35:00 pm »
Nice. It worked.