Home > Database > Mysql Tutorial > Sqlserver与Mysql触发器有什么差别呢?

Sqlserver与Mysql触发器有什么差别呢?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 16:17:13
Original
1127 people have browsed it

下面显示的是触发器用到的两个表 --创建sc表CREATETABLE[sc]([ScId]intNOTNULL,[SNo]intNOTNULL,[CNo]intNOTNULL,[Score]intDEFAULTNULL,PRIMARYKEY([ScId]) ); --添加履历表CREATETABLEscore_record ( SrIdintNOTNULL, SNointNOTNULL, CNointNOTNULL, OldSc

   下面显示的是触发器用到的两个表

  --创建sc表CREATETABLE[sc]([ScId]intNOTNULL,[SNo]intNOTNULL,[CNo]intNOTNULL,[Score]intDEFAULTNULL,PRIMARYKEY([ScId])

  );

  --添加履历表CREATETABLEscore_record (

  SrIdintNOTNULL,

  SNointNOTNULL,

  CNointNOTNULL,

  OldScoreintNOTNULL,

  NewScoreintNOTNULL,

  UpdateTimedatetimeNOTNULL,PRIMARYKEY(SrId),

  );

  下面显示的是Mysql写的触发器

  --Mysql写的触发器--创建触发器,将修改前后的成绩插入到履历表DROPTRIGGERIFEXISTS`trigger_sr`;

  DELIMITER//CREATETRIGGER`trigger_sr` AFTERUPDATEON`sc`FOREACH ROWBEGININSERTINTOscore_recordSETSNo=new.SNo,

  CNo=new.CNo,

  OldScore=old.Score,

  NewScore=new.Score,

  UpdateTime=NOW() ;END//DELIMITER ;

  下面显示的是Sqlserver写的触发器

  --Sqlserver写的触发器--创建触发器,将修改前后的成绩插入到履历表CREATETRIGGERtrigger_sronscforupdateasdeclare@

  这个只是触发器之间的差别,像储存过程,自定义函数等一定还有很大的区别,不过,现在的感觉是学完一种数据库语言,,其他的数据库学起来也是那样吧。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Problem with tp6 connecting to sqlserver database
From 1970-01-01 08:00:00
0
0
0
Unable to connect to SQL Server in Laravel
From 1970-01-01 08:00:00
0
0
0
Methods of parsing MYD, MYI, and FRM files
From 1970-01-01 08:00:00
0
0
0
SQLSTATE: User login failed
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template