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 = 1 AND AreaFunctionNumber = 45)
    INSERT INTO PERSONELACCESS(UserIdNumber,AreaFunctionNumber,Access,AreaNumber) VALUES (@UserIdNumber, 45, 2, 1)
  FETCH NEXT FROM db_user INTO @UserIdNumber
END  

CLOSE db_user
DEALLOCATE db_user