日期:2014-05-18  浏览次数:20526 次

求助!!!触发器跳不过去???
create trigger interg_disc 
on members
for update 
as
begin
  /*declare @memberID int,@integral int
  select @memberID=memberID ,@integral=integral from members where status='true'
  if(@integral>300 and @integral<600 )
  update members set discount=0.8 where memberID=@memberID
  else if(@integral>600)
  update members set discount=0.7 where memberID=@memberID
  update members set status='false' where memberID=@memberID*/
end

跳出:消息 102,级别 15,状态 1,第 1 行
' ' 附近有语法错误。

------解决方案--------------------
interg_disc后又一个全角空格
------解决方案--------------------
这样就行了.
SQL code
create trigger interg_disc
on members
for update
as
begin
declare @memberID int,@integral int
  select @memberID=memberID ,@integral=integral from members where status='true'
  if(@integral>300 and @integral<600 )
  update members set discount=0.8 where memberID=@memberID
  else if(@integral>600)
  update members set discount=0.7 where memberID=@memberID
  update members set status='false' where memberID=@memberID
end

------解决方案--------------------
begin和end之间要有内容