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 [email protected]
else if(@integral>600)
update members set discount=0.7 where [email protected]
update members set status='false' where [email protected]*/
end
跳出:消息 102,级别 15,状态 1,第 1 行
' ' 附近有语法错误。
------解决方案--------------------
interg_disc后又一个全角空格
------解决方案--------------------
这样就行了.
- SQL code
create trigger interg_discon membersfor updateasbegindeclare @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 [email protected] else if(@integral>600) update members set discount=0.7 where [email protected] update members set status='false' where [email protected]end
------解决方案--------------------
begin和end之间要有内容