create trigger mytrg ON tableA
for insert
AS
IF (select * from table1A where aa='sun1' ) is not NULL
BEGIN
Update tableA
set bb=8,cc=7
where aa='sun1' and bb=3 and cc=2
delete * from inserted
END
for insert
AS
IF (select * from table1A where aa='sun1' ) is not NULL
BEGIN
Update tableA
set bb=8,cc=7
where aa='sun1' and bb=3 and cc=2
delete * from inserted
END
解决方案 »
- 一个触发器的问题
- 这样的表结构该如果查询
- 用C语言写了一个多线程序下载器,下载速度快的无与伦比,大小只有86K,可下载任何文件!(免费+开源)
- sql server2000中,关于触发器的问题!想不通~~~
- SQL查询问题 求解决
- b/s,c/s模式
- 在SQL Server 中用 SQL语句如何在一个日期字段值的基础上增加一个月
- 相见恨晚,Sql Server 版,Unite!
- vfp的结构体系早已经被淘汰了,为什么现在用vfp的还这么多?实在害人哪,哪怕用access都要好得多啊。
- 如何让一列只显示正整数?
- 关于SQL Server Transact-SQL API 的问题
- 怎样将2000上的数据库移植到6.5上啊?
for insert
if exist(select tablea.sun1 from tablea,inserted where tablea.sun1=inserted.sun1)
update tablea set sun1=inserted.sun1,bb=tablea.bb+inserted.bb,cc=tablea.cc+inserted.cc
from tablea,inserted
else
insert into tablea (select * from inserted)
还是同意nononono(null,null)的意见,多加一个临时表来存放原始记录。