请问我这个存储过程是怎改才对啊?
我想实现的效果是修改一个学员的信息后,看咨询师有没变和学员报名类型有没变,来相应修改跟踪学员表和业绩表的值的效果。代码的结果是没错的了,但就是有语法错误请看看语法错在哪?谢!具体SQL存储过程代码如下:if exists(select * from sysobjects where name='proc_UpdateStu')
drop proc proc_UpdateStu
GOcreate 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 & @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 & @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 & @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