错误信息:服务器: 消息 170,级别 15,状态 1,过程 proc_UpdateStu,行 32
第 32 行: '=' 附近有语法错误。
服务器: 消息 156,级别 15,状态 1,过程 proc_UpdateStu,行 40
在关键字 'else' 附近有语法错误。
服务器: 消息 170,级别 15,状态 1,过程 proc_UpdateStu,行 41
第 41 行: '=' 附近有语法错误。
服务器: 消息 156,级别 15,状态 1,过程 proc_UpdateStu,行 52
在关键字 'else' 附近有语法错误。

解决方案 »

  1.   

    /*
    先将==换成=看看
    */create proc proc_UpdateStu@id varchar(50),@name varchar(20),@sex char(10),@age int,@jg varchar(20),@image varchar(200),@telephone varchar(20)
    ,@feelphone varchar(20),@email varchar(50),@employee bit,@employeename varchar(20),@employeetime datetime,@power
    varchar(20),@learnby varchar(50),@class int,@address varchar(50),@student bit,@school varchar(50),@level varchar(20)
    ,@slearnby varchar(50),@know varchar(20),@need text,@bark text,@stutype varchar(20),@teacherid varchar(50),@stusearch
    varchar(20),@stujoin varchar(20),@stuno varchar(20)asdeclare @type varchar(20),@tempid varchar(50)select @type=tstutype from Student_Info where tid=@idset @tempid=@teacheridbegin transactionupdate Student_Info set tname=@name,tsex=@sex,tage=@age,tjiguan=@jg,timage=@image,ttelephone=@telephone,
    tfeelphone=@feelphone,temail=@email,temployee=@employee,temployeename=@employeename,temployeetime=@employeetime,
    tpower=@power,tlearnby=@learnby,tclass=@class,taddress=@address,tstudent=@student,tschool=@school,tlevel=@level,
    tslearnby=@slearnby,tknow=@know,tneed=@need,tbark=@bark,tstutype=@stutype,tteacherid=@teacherid,
    tstusearch=@stusearch,tstujoin=@stujoin,tstuno=@stuno where tid=@iddeclare @type1 varchar(20),@tempid1 varchar(50)select @type1=tstutype from Student_Info where tid=@idselect @tempid1=tteacherid from Student_Info where tid=@idif(@type<>@type1 and @tempid=@tempid1)
    --if(@type<>@type1 and @tempid==@tempid1)
    begin
    if(@type1 like '注册')
    update Cut_Info set cnum=cnum+1 where cid=@tempid
    else
    if(@type1 like '咨询')
    update Cut_Info set cnum=cnum-1 where cid=@tempid
    end
    else
    --if(@type==@type1 and @tempid<>@tempid1)
    if(@type=@type1 and @tempid<>@tempid1)
    begin
    if(@type1 like '注册')
    begin
    update Cut_Info set cnum=cnum+1 where cid=@tempid1
    update Cut_Info set cnum=cnum-1 where cid=@tempid
    end
    else
    if(@type1 like '咨询')
    update Find_Info set tid=@tempid1 where sid=@id
    end
    else
    if(@type<>@type and @tempid<>@tempid1)
    begin
    if(@type1 like '注册')
    begin
    update Cut_Info set cnum=cnum+1 where cid=@tempid1
    delete from Find_Info where sid=@id
    end
    else
    if(@type like '咨询')
    begin
    update Cut_Info set cnum=cnum-1 where cid=@tempid
    update Find_Info set tid=@tempid1 where sid=@id
    end
    endif(@@error>0)
    rollback transaction
    else
    commit transaction
    GO
      

  2.   

    SQL Server不支持 '==' 的表达式。
      

  3.   

    在sql语句中不能用==,用=就好