处理错误"在函数内不正确地使用了 'INSERT'。"
各位大侠们好! 
             今天在调试SQL时写了一个函数用于向数据库中插入一条记录: 
 use   职工考勤数据库 
 --创建函数向数据库中插入出差记录 
 if   exists(select   *   from   sysobjects   where   name   =    'InsertEvection '   and   type   =    'fn ') 
 drop   function   InsertEvection 
 go 
 --在此函数中假定插入记录的开始日期是要小于结束日期的 
 create   function   InsertEvection   ( 
 @worNo   char(5),   --参数1:要插入的出差记录的员工编号 
 @beginTime   datetime,   --参数2:出差开始日期 
 @endTime   datetime,--参数3:出差的结束日期 
 @place   char(30)   )   --参数4:出差地点 
 returns   int   --返回值:返回0,插入失败;返回1则插入成功 
 as 
 begin 
          declare   @successor   int   --定义变量,以其作为返回值 
          --判断插入记录的开始时间和结束时间的合法性 
          --插入记录的开始时间大于结束时间,则置返回值为0 
          if   @beginTime   > @endTime 
                   set   @successor   =   0 
          else 
          --否则进行数据插入的判断 
          begin 
                   --查找并判断出差开始时间 
                   --1、某一员工的出差记录的结束时间小于其所有出差记录的开始时间,则插入数据 
                   if   not   exists(select   *   from   出差登记表    
                                                                where   @endTime    <   出差开始日期   and   员工编号   =   @worNo) 
                   begin 
                            set   @successor   =   1   --设置返回值 
                            --插入出差记录 
                            insert   into   出差登记表(员工编号,出差开始日期,出差结束日期,出差地点) 
                            values(@worNo,@beginTime,@endTime,@place) 
                   end 
                   --2、某一员工的出差记录的开始时间大于其所有出差记录的结束时间,则插入数据 
                      else   if   not   exists(select   *   from   出差登记表    
                                                                where   @beginTime   >    出差结束日期   and   员工编号   =   @worNo) 
                   begin 
                            set   @successor   =   1   --设置返回值 
                            --插入出差记录 
                            insert   into   出差登记表(员工编号,出差开始日期,出差结束日期,出差地点) 
                            values(@worNo,@beginTime,@endTime,@place) 
                   end 
                   --3、要插入的出差记录可能与当前的时间发生冲突,则插入失败 
                   else 
                            set   @successor   =   0 
          end 
          return   @successor 
 end 
 然后在调试执行的过程中,给出这样的错误: 
 服务器:   消息