3 Replies Latest reply on Oct 6, 2014 7:27 AM by jonathanfourie

    How would I delete all assets out of Web Help Desk

    jakecornejo

      We are currently using Spiceworks for asset tracking and when I went to import all of our information from Spiceworks into WHD it would only take a about 1/3 of the equipment  and error-ed out on the rest. Now everything is all off and I am not sure what got imported and what did not. SO my question is their any way to delete ALL assets out of WHD so I can start over with the asset import?

       

      Note: I tried the Bulk Edit option to delete all of them but for some reason that did not work and I also exported all the assets into a CSV and marked Yes for the Delete option but that did not seem to work either. Any tricks or help would be greatly appreciated. Thanks!

        • Re: How would I delete all assets out of Web Help Desk
          Peter Krutý

          What do you mean by saying that bulk edit did not work? What exactly happened and how it was different to what you would expect?

            • Re: How would I delete all assets out of Web Help Desk
              yaquaholic

              jakecornejo We had a similar problem, where our asset DB was corrupted by the NPM asset discovery. We raised a call to Solarwinds support (Case # 606976), who after some trials and tribulations, gave us the following SQL to delete all assets from Web Help Desk and reset the asset_id to 0.

               

              This is of course destructive and will delete all assets and break all associated purchase orders and assets within existing tickets.

              I would strongly advise on a backup of the database, or at least the tables mentioned, possibly even raise it as a call to SolarWinds Support for their assistance....

               

              You need to access the database (in our example PostgreSQL) and here's the PostgreSQL:

               

              --Clean up Asset table and references

              UPDATE job_ticket SET asset_id=NULL;

              UPDATE po_item SET asset_id=NULL;

              UPDATE asset SET po_item_id=NULL, parent_id=NULL;

              DELETE FROM asset_custom_field;

              DELETE FROM asset_bulk_action_child;

              DELETE FROM asset_bulk_action_parent;

              DELETE FROM asset_client;

              DELETE FROM asset_generic_attachment;

              DELETE FROM asset_history;

              DELETE FROM asset_reservation_asset;

              DELETE FROM job_ticket_asset;

              DELETE FROM po_item;

              DELETE FROM asset_parent_child; --added to break the child/parent fk problem

              DELETE FROM asset;

              DELETE FROM computer_identity;

              DELETE FROM nodes;

              --Reset asset_id count

              ALTER SEQUENCE asset_seq RESTART 1;

               

              I hope it helps, it certainly gave us a nice clean sheet to start again with.

                • Re: How would I delete all assets out of Web Help Desk
                  jonathanfourie

                  This is a script I created for Microsoft SQL server

                  I am not an official DBA but I know enough to get around

                  This also deletes the manufacturer and model databases

                  Please test first before using it

                   

                  I am still finding the table/record for the sequencing of the numbers though

                   

                  UPDATE [dbo].[JOB_TICKET]

                     SET [ASSET_ID] = NULL

                  GO

                  UPDATE [dbo].[PO_ITEM]

                    SET [ASSET_ID] = NULL

                  GO

                  UPDATE [dbo].[ASSET]

                    SET [PO_ITEM_ID] = NULL

                    ,[PARENT_ID] = NULL

                  GO

                  UPDATE [dbo].[JOB_TICKET]

                    SET [MODEL_ID] = NULL

                  GO

                  DELETE FROM [dbo].[ASSET_CUSTOM_FIELD]

                  GO

                  DELETE FROM [dbo].[ASSET_BULK_ACTION_CHILD]

                  GO

                  DELETE FROM [dbo].[ASSET_BULK_ACTION_PARENT]

                  GO

                  DELETE FROM [dbo].[ASSET_CLIENT]

                  GO

                  DELETE FROM [dbo].[ASSET_GENERIC_ATTACHMENT]

                  GO

                  DELETE FROM [dbo].[ASSET_HISTORY]

                  GO

                  DELETE FROM [dbo].[ASSET_RESERVATION_ASSET]

                  GO

                  DELETE FROM [dbo].[JOB_TICKET_ASSET]

                  GO

                  DELETE FROM [dbo].[PO_ITEM]

                  GO

                  DELETE FROM [dbo].[ASSET_PARENT_CHILD]

                  GO

                  DELETE FROM [dbo].[ASSET]

                  GO

                  DELETE FROM [dbo].[COMPUTER_IDENTITY]

                  GO

                  DELETE FROM [dbo].[NODES]

                  GO

                  DELETE FROM [dbo].[MANUFACTURER]

                  GO

                  DELETE FROM [dbo].[MODEL]

                  GO