sqlserver2000触发器与存储器- 会飞的鱼[kingcat2010]雪压青松松不倒 ...



示例一:
create table sc(

   sno varchar(20) not null primary key,

   grade int not null

)

IF EXISTS (SELECT name 

	   FROM   sysobjects 

	   WHERE  name = 'u_sc'  AND  type = 'TR')

    DROP TRIGGER u_sc

GO

create trigger U_SC

on sc for update

As  if update(grade)

begin

raiserror('you can not modify this column',17,1)

rollback transaction

end 

go 

update sc

set grade=90

where sc.sno='95010'

示例二:
IF EXISTS (SELECT name 

	   FROM   sysobjects 

	   WHERE  name = 'd_s'  AND  type = 'TR')

    DROP TRIGGER d_s

GO

create trigger d_s

on student  for delete

As   

delete sc

where sc.sno in (select sno from deleted)

Go   



delete student where sno='95001'


示例三:
CREATE TRIGGER TRIGGER_GRADE

ON STUDENT_INFO  AFTER INSERT

AS

IF (SELECT SCORE FROM STUDENT_INFO )>100  OR (SELECT SCORE FROM STUDENT_INFO)<0

BEGIN 

PRINT '成绩要求在0-100范围之内'

ROLLBACK

END  

{zx1}评论

  • ?上次留言太冲动了 这次好好感觉一下oracle 如果大家对oracle感兴趣,建 ...
    -- by

  • XML + XSLT 方式只是页面展示, 好像还是没有办法设置动态表单吧.
    -- by

  • linghongli 写道//创建临时表空间 create temporary t ...
    -- by

  • 第二个,看版规是有必要的。 对版规有意见是一回事,版规没改之前先遵守是另一回事。 ...
    -- by

  • young_suse 写道swen00 写道zhoujia 写道linghongl ...
    -- by
郑重声明:资讯 【sqlserver2000触发器与存储器- 会飞的鱼[kingcat2010]雪压青松松不倒 ...】由 发布,版权归原作者及其所在单位,其原创性以及文中陈述文字和内容未经(企业库qiyeku.com)证实,请读者仅作参考,并请自行核实相关内容。若本文有侵犯到您的版权, 请你提供相关证明及申请并与我们联系(qiyeku # qq.com)或【在线投诉】,我们审核后将会尽快处理。
—— 相关资讯 ——