create trigger GetAllPointOnUserInfoChange
on UserInfo
for update,insert
as
declare @point int,@point_bank int,@point_mno int,@point_present int,@point_BabaoVoteYY int,@userid nvarchar
select @point=inserted.point,@point_bank=inserted.point_bank,@point_mno=inserted.point_mno,@point_present=inserted.point_present,@userid=inserted.userid,@point_BabaoVoteYY=BabaoVoteYY.point from inserted left join BabaoVoteYY on inserted.userid collate Chinese_PRC_CI_AS=BabaoVoteYY.userid collate Chinese_PRC_CI_AS
if @point_BabaoVoteYY is null
set @point_BabaoVoteYY=0
update UserInfo set allpoint=@point+@point_bank+@point_mno+@point_present+@point_BabaoVoteYY where userid=@userid
**********************************************************************************************
create trigger GetAllPointOnBabaoVoteYYChange
on BabaoVoteYY
for update,insert
as
declare @point_UserInfo int,@point_bank_UserInfo int,@point_mno_UserInfo int,@point_present_UserInfo int,@point int,@userid nvarchar
select @point_UserInfo=UserInfo.point,@point_bank_UserInfo=UserInfo.point_bank, @point_mno_UserInfo=UserInfo.point_mno,@point_present_UserInfo=UserInfo.point_present,@userid=inserted.userid,@point=inserted.point from inserted,UserInfo where inserted.userid collate Chinese_PRC_CI_AS=UserInfo.userid collate Chinese_PRC_CI_AS
update UserInfo set allpoint=@point_UserInfo+@point_bank_UserInfo+@point_mno_UserInfo+@point_present_UserInfo+@point where userid=@userid
on UserInfo
for update,insert
as
declare @point int,@point_bank int,@point_mno int,@point_present int,@point_BabaoVoteYY int,@userid nvarchar
select @point=inserted.point,@point_bank=inserted.point_bank,@point_mno=inserted.point_mno,@point_present=inserted.point_present,@userid=inserted.userid,@point_BabaoVoteYY=BabaoVoteYY.point from inserted left join BabaoVoteYY on inserted.userid collate Chinese_PRC_CI_AS=BabaoVoteYY.userid collate Chinese_PRC_CI_AS
if @point_BabaoVoteYY is null
set @point_BabaoVoteYY=0
update UserInfo set allpoint=@point+@point_bank+@point_mno+@point_present+@point_BabaoVoteYY where userid=@userid
**********************************************************************************************
create trigger GetAllPointOnBabaoVoteYYChange
on BabaoVoteYY
for update,insert
as
declare @point_UserInfo int,@point_bank_UserInfo int,@point_mno_UserInfo int,@point_present_UserInfo int,@point int,@userid nvarchar
select @point_UserInfo=UserInfo.point,@point_bank_UserInfo=UserInfo.point_bank, @point_mno_UserInfo=UserInfo.point_mno,@point_present_UserInfo=UserInfo.point_present,@userid=inserted.userid,@point=inserted.point from inserted,UserInfo where inserted.userid collate Chinese_PRC_CI_AS=UserInfo.userid collate Chinese_PRC_CI_AS
update UserInfo set allpoint=@point_UserInfo+@point_bank_UserInfo+@point_mno_UserInfo+@point_present_UserInfo+@point where userid=@userid