SET NOCOUNT ON
DECLARE @FK_DepartmentNumber INT
DECLARE @UserIdNumber INT
DECLARE @AreaFunctionNumber INT

DECLARE db_user CURSOR FOR
  SELECT UserIdNumber FROM Personel WITH (NOLOCK)
OPEN db_user

FETCH NEXT FROM db_user INTO @UserIdNumber

WHILE @@FETCH_STATUS = 0
BEGIN
  IF NOT EXISTS(SELECT * FROM PersonelAccess WITH (NOLOCK) WHERE UserIdNumber = @UserIdNumber AND AreaNumber = 6 AND AreaFunctionNumber = 0)
    INSERT INTO PersonelAccess (UserIdNumber, AreaFunctionNumber, Access, AreaNumber) VALUES (@UserIdNumber, 0, 0, 6)
  IF NOT EXISTS(SELECT * FROM PersonelAccess WITH (NOLOCK) WHERE UserIdNumber = @UserIdNumber AND AreaNumber = 6 AND AreaFunctionNumber = 1)
    INSERT INTO PersonelAccess (UserIdNumber, AreaFunctionNumber, Access, AreaNumber) VALUES (@UserIdNumber, 1, 0, 6)
  FETCH NEXT FROM db_user INTO @UserIdNumber
END  

CLOSE db_user
DEALLOCATE db_user