Insert 触发器
来源:互联网 发布:苹果如何更改知乎话题 编辑:程序博客网 时间:2024/05/22 08:21
create Table Bank( insert into Bank values('zhansan',500) (1 行受影响) (1 行受影响) ------------------------------------------------------ (1 行受影响) (1 行受影响) 另外,update触发器和delete触发器和insert触发器基本相同。
CardID int primary key identity(1,1),
BankUserName nvarchar(50),
CurrentMomney decimal(10,2),
)
create Table Inserted(
ID int primary key identity(1,1),
CardID int foreign key(CardID) references Bank(CardID),
TransType nvarchar(30),
TransMoney decimal(10,2),
)
create trigger trig_TransInfo
on Inserted --表名
for insert --触发器类型
as
declare @type char(4),@outmoney decimal(10,2)
declare @mycardID int,@balance decimal(10,2)
select @type=TransType,@outmoney=TransMoney,@mycardID=CardID from Inserted
if(@type='支取')
update Bank set CurrentMomney=CurrentMomney-@outmoney where CardID=@mycardID
else
update Bank set CurrentMomney=CurrentMomney+@outmoney where CardID=@mycardID
go
insert into Bank values('lisi',10000)
insert into Bank values('wangwu',2000)
insert into Inserted values(1,'支取',100)
insert into Inserted values(2,'存储',500)
- Insert 触发器
- insert插入触发器
- Insert , Update , Delete 触发器
- insert 触发器例子
- sqlserver insert 触发器
- mysql insert触发器事例
- 触发器 insert instead of
- insert触发器实例
- Mssql触发器学习例子之INSERT触发器
- INSERT触发器的工作过程
- mysql insert与update触发器
- MySQL中的触发器insert、update
- 1, insert触发器; 2, update触发器; 3, delete触发器;
- sqlite3 update/insert/insert or replace对触发器的影响
- 触发器---FOR INSERT与INSTEAD OF
- 一个触发器内三种INSERT,UPDATE,DELETE状态
- SQL 表的Insert ,update ,delete 触发器
- 触发器例子,insert into all的用法
- phpbb gallery 相簿安装
- 15个学习习惯,受益一生
- dcom错误解决方法
- 防止页面后退重复刷新
- C#时间处理(DateTime和TimeSpan)
- Insert 触发器
- 【warning: assignment makes pointer from integer without a cast 】
- 存储过程
- javamail实例-发送邮件和收取邮件
- mini2440上移植sqlite3.7.6.2
- 读取Excel表
- DLL Inject
- 解决 “System.DllNotFoundException …找不到指定的模块.”
- .NET工程师必须掌握的知识点