--Insert NoAccess 0, ReadOnly 1, ReadWrite 2
DECLARE @AreaId INT, @FuncId INT
SET @AreaId = 5 --Management
SET @FuncId = 36 --afTimeRegistration
INSERT INTO PersonelAccess (UserIdNumber, AreaFunctionNumber, Access, AreaNumber)
SELECT P.UserIdNumber, 36, CASE WHEN UserIDCode = 'Techotel' THEN 2 ELSE 0 END, 5
FROM Personel P WITH (NOLOCK)
WHERE NOT P.UserIdNUmber IN 
(
  SELECT UserIDNumber
  FROM PersonelAccess WITH (NOLOCK)
  WHERE AreaFunctionNumber = 36
  AND AreaNumber = 5
)