Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
langsql
titleDetect Imported Users that are a duplicate
select \* from Inv_Global_Windows_Users GWU
WHERE EXISTS 	(select 1 from ResourceKey RK where RK.KeyName = 'name.domain' and RK.KeyValue= (GWU.UserId + '.' + GWU.Domain) and RK.ResourceGuid \!= GWU._ResourceGuid)
Code Block
langsql
titleDetects Users populated with domain details that should have a resource key populated
select \* from Inv_Global_Windows_Users GWU
WHERE NOT EXISTS  	(select 1 from ResourceKey RK where RK.KeyName = 'name.domain' and RK.KeyValue= (GWU.UserId + '.' + GWU.Domain))
	AND UserId IS NOT NULL
Code Block
langsql
titleInserts ResourceKeys for Users that have Domain details populated, but no corresponding resource Key exists
INSERT INTO ResourceKey(ResourceGuid, KeyName, KeyValue)
select GWU._ResourceGuid, 'name.domain', (GWU.UserId + '.' + GWU.Domain) from Inv_Global_Windows_Users GWU
WHERE NOT EXISTS
(select 1 from ResourceKey RK where RK.KeyName = 'name.domain' and RK.KeyValue= (GWU.UserId + '.' + GWU.Domain))
AND UserId IS NOT NULL