How to delete records from a custom inventory table for single resource


Article ID: 180957


Updated On:


Inventory Solution


I am testing a custom inventory, and the default behavior is to not reload matching data. How can I remove or delete records for a given resource from a custom inventory table?


If you only want to delete data for one resource, the following query can help. To delete records for a single resource from a custinv table:

-- @rguid is the _resourceguid for the client computer
-- @dcguid is the dataclass guid. It can be found in various ways, including:
--    select * from dataclass where name = '<dataclass name>'
DECLARE @rguid varchar(36)
DECLARE @dcguid varchar(36)
DECLARE @custtablename varchar(256)

set @rguid = ‘???’
set @dcguid = '???'
set @custtablename = ‘???’

delete from @custtablename where _resourceguid = @rguid
delete from resourceupdatesummary 
  where resourceguid = @rguid 
    and inventoryclassguid = @dcguid