Hi Kal451,
if your need is to create a solid relationship between the asset and its last user you can benefit from this SQL script:
Set IDENTITY_INSERT [lansweeperdb].[dbo].[tblAssetUserRelations] ON
GO
DECLARE @offset integer;
set @offset = (Select Max(RelationID) + 1 from [lansweeperdb].[dbo].[tblAssetUserRelations]);
insert into [lansweeperdb].[dbo].[tblAssetUserRelations] (
[RelationID],[Username] ,[Userdomain] ,[AssetID] ,[Type] ,[Comments] ,[Lastchanged] ,[StartDate] ,[EndDate] ,[Ou] ,[AdObjectId] ,[IsLocalUser])
select ROW_NUMBER() OVER(PARTITION BY NULL ORDER BY AssetID) + @offset as RelationID,
a.Username,
a.Userdomain,
a.[AssetID],
12 as Type, -- UsedBy see tsysAssetRelationTypes table
null as Comments,
GETDATE() as Lastchanged,
null as StartDate,
null as EndDate,
null as Ou,
null as AdObjectId,
case a.FQDN
when null then 1
else 0
end as IsLocalUser
FROM [lansweeperdb].[dbo].[tblAssets] a
Where Username > ''
Set IDENTITY_INSERT [lansweeperdb].[dbo].[tblAssetUserRelations] OFF
GO