Upgrades can fail while configuring Network Inventory with the following error:
PK_LicenseInUse primary key violation
8.x
A primary key violation of the LicenceInUse table
The following sql can be run to resolve the issue that can cause the primary key violation:
DECLARE @temp TABLE (LicensingPolicyGuid UNIQUEIDENTIFIER, ResourceGuid UNIQUEIDENTIFIER, CreatedDate DATETIME, ModifiedDate DATETIME)
insert into @temp select 'CD39B720-F871-11D2-8643-00104B74A9DF', ResourceGuid, min (CreatedDate), max (ModifiedDate) from LicenseInUse
where LicensingPolicyGuid in ('CD39B720-F871-11D2-8643-00104B74A9DF', '1eaa6e77-0f4e-44a8-a2b3-4a035bef3b71')
group by ResourceGuid
select * from @temp
delete from LicenseInUse where LicensingPolicyGuid in ('CD39B720-F871-11D2-8643-00104B74A9DF', '1eaa6e77-0f4e-44a8-a2b3-4a035bef3b71')
insert into LicenseInUse select * from @temp
IMPORTANT: Do not change any of the guids in the script above.