create trigger my_tr1 on b
for updateif update(Support)
begin
--根据连接条件
--SupportCount在原来的基础上加1
endif update(Against)
begin
--根据连接条件
--a表的AgainstCount在原来的基础上加1
end
go
for updateif update(Support)
begin
--根据连接条件
--SupportCount在原来的基础上加1
endif update(Against)
begin
--根据连接条件
--a表的AgainstCount在原来的基础上加1
end
go
解决方案 »
- sql server 2008 安装软件打不开 求助
- 求教一条SQL语句解决盘点库存
- 有什么好办法将"2008-09-05 下午 01:02:06" 格式转为 2008-09-05 13:02:06
- SQL中如何查询当天的数据。
- 请教一个数据库考试有关数据挖掘的题目
- sql2005 无法删除自定义类型,因为正在使用
- 紧急求救,遇到下面的怪问题。SQLException:[Microsoft][ODBC SQL Server Driver]连接占线导致另一个hstmt
- sql2000中update OPENDATASOURCE问题,为什么在sql2000中不能用
- SQL Server中是否有错误Catch机制.
- Excel
- sql server数据库收缩后,后来机器重装了,附加数据库不成功
- 看书上说Replication是DBA的Nightmare,事实证明的确如此
--SupportCount在原来的基础上加1
一楼能不能写的详细点呵
for update
as
if update(Support)
begin
--根据连接条件
--SupportCount在原来的基础上加1update a
set a.SupportCount=a.SupportCount+1
from a,inserted i
where a.id = i.id--如果两表都有id,且相关联
endif update(Against)
begin
--根据连接条件
--a表的AgainstCount在原来的基础上加1update a
set a.AgainstCount=a.AgainstCount+1
from a,inserted i--如果两表都有id,且相关联
where a.id = i.id
end
go