What is the difference between SQL Server and MySQL triggers?

Source: Internet
Author: User

The two tables used by the trigger are shown below

--Create SC table CREATETABLE[SC] ([Scid]intnotnull,[sno]intnotnull,[cno]intnotnull,[score]intdefaultnull,primarykey ([ScId ])

);

--Add Resume Createtablescore_record (

Sridintnotnull,

Snointnotnull,

Cnointnotnull,

Oldscoreintnotnull,

Newscoreintnotnull,

Updatetimedatetimenotnull,primarykey (SrId),

);

The following is a MySQL-written trigger

--mysql write triggers-create triggers, insert the results before and after the change into the resume 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;

The following are the triggers written by SQL Server

--sqlserver write triggers--create triggers, insert the results before and after the changes into the resume createtriggertrigger_sronscforupdateasdeclare@

This is just the difference between triggers, such as stored procedures, custom functions and so there must be a big difference, but now the feeling is to learn a database language, and other databases to learn the same.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.