表中某列被修改后触发器SQL例子
来源:互联网 发布:金山数据恢复大师破解 编辑:程序博客网 时间:2024/05/16 04:33
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
CREATETABLE[TEST](
[FID][int]IDENTITY(1,1)NOTNULL,
[F1][int]NULL,
[F2][int]NULL,
[F3][int]NULL,
CONSTRAINT[PK_TEST]PRIMARYKEY CLUSTERED
(
[FID]
) ON[PRIMARY]
)ON[PRIMARY]
GO
alterTRIGGERupdatetestON[dbo].[TEST]
FORINSERT,UPDATE,DELETE
AS
begin
declare@F1 int,
@FID int,
@OldF1 int
ifupdate(F1)
begin
select@OldF1=F1fromtestwhereFIDin(selectFIDfromINSERTED)
select@FID=FID,@F1=F1fromINSERTED
PRINT'fID='+convert(varchar(10),@FID)
PRINT'OldF1='+convert(varchar(10),@OldF1)
PRINT'F1='+convert(varchar(10),@F1)
end
end
go
inserttest(f1,f2,f3)values(1,2,3)
go
select*fromtest
go
updatetestsetf1=11wherefid=1
go
--问题:不能获得修改前的值???
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
CREATETABLE[TEST](
[FID][int]IDENTITY(1,1)NOTNULL,
[F1][int]NULL,
[F2][int]NULL,
[F3][int]NULL,
CONSTRAINT[PK_TEST]PRIMARYKEY CLUSTERED
(
[FID]
) ON[PRIMARY]
)ON[PRIMARY]
GO
alterTRIGGERupdatetestON[dbo].[TEST]
FORINSERT,UPDATE,DELETE
AS
begin
declare@F1 int,
@FID int,
@OldF1 int
ifupdate(F1)
begin
select@OldF1=F1fromtestwhereFIDin(selectFIDfromINSERTED)
select@FID=FID,@F1=F1fromINSERTED
PRINT'fID='+convert(varchar(10),@FID)
PRINT'OldF1='+convert(varchar(10),@OldF1)
PRINT'F1='+convert(varchar(10),@F1)
end
end
go
inserttest(f1,f2,f3)values(1,2,3)
go
select*fromtest
go
updatetestsetf1=11wherefid=1
go
--问题:不能获得修改前的值???
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
- 表中某列被修改后触发器SQL例子
- sql触发器的例子。
- [Sql]使用触发器禁止创建后的修改动作
- SQL Server 两个触发器例子
- SQL SERVER触发器示范例子
- SQL Server 学习笔记⑧- 触发器(修改前和修改后的语句插入指定表中)
- 触发器获取修改表的SQL语句
- sql 触发器 修改某一列触发
- SQL Server触发器创建、删除、修改、查看
- SQL Server触发器创建、删除、修改、查看
- SQL Server触发器创建、删除、修改、查看
- SQL Server触发器创建、删除、修改、查看
- SQL Server触发器创建、删除、修改、查看
- SQL Server触发器创建、删除、修改、查看
- SQL Server触发器创建、删除、修改、查看
- SQL Server触发器创建、删除、修改、查看
- 触发器例子
- 触发器例子
- 一个将数据分页的存储过程
- Tomcat配置技巧Top10[ZT]
- 日期时间转换为日期的SQL语句
- NetBeans 时事通讯(刊号 # 3 - Apr 15, 2008)
- 你们都是怎么了?
- 表中某列被修改后触发器SQL例子
- NetBeans 时事通讯(刊号 # 4 - Apr 22, 2008)
- 转储控制文件头
- 关于竖表转横表的问题
- Java - interface01
- 如何从结果集中获得随机结果
- 使用Rman的Plusarchvielog选项简化备份操作
- 显示中所有表及其信息
- SQL函数