How to use MySQL triggers to migrate and synchronize data,
1. migrate dataPort the database, SQL Server => MySQL. SQL Server has the following triggers
SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO ALTER TRIGGER [trg_risks] ON dbo.projectrisk
Database trigger details bitsCN. com1 introduction
Like the stored procedure, Mysql triggers are embedded into a mysql program. The trigger is a new function of mysql5. Currently, the online Fengchao system, Beidou system, and Columbus system use
/*
Create a virtual test environment, including the table [cigarette inventory table] and table [cigarette sales table].
Please pay attention to tracking the data of these two tables and understanding what business logic the trigger has executed and
A simple example
1.1. Create a table:
CREATE TABLE T (S1 integer);
1.2. Triggers:
The code is as follows
Copy Code
? delimiter |Create trigger T_trigger before insert on t for each rowBegin Set @x = "Hello
MySQL Tutorial triggers database tutorial Synchronizing data methods
Database nameDriver table The table being triggered/***-------------------Documentation Comments------------------------------------------* The author * tatsu *qq 85089479*email
The examples in this article describe the use of Oracle triggers. Share to everyone for your reference, specific as follows:
Introduction of Triggers
The definition of a trigger is that when a condition is set up, the statement defined within the
Function:
1, allow/limit the modification of the table
2, automatically generate derived columns, such as self-added fields
3. Enforce data consistency
4. Provide audit and log records
5, prevent invalid transaction processing
6. Enable Complex
Show TRIGGERS; View all triggersCreate Trigger TG1After insert on userFor each rowBeginUpdate user set Name= ' test ' where id=1;EndInsert into User (Name,pass) VALUES (' Shao ', ' 23 ') $$CREATE Trigger SyntaxCREATE TRIGGER trigger_name
A trigger is a code block automatically executed when a specific event occurs. It is similar to a stored procedure, but users cannot directly call them.
A trigger is a code block automatically executed when a specific event occurs. It is similar to
(15) mysql triggers and 15mysql triggers Overview
A trigger, as its name implies, executes a program when something (event) occurs. Triggers have four main elements:Monitored location (table_name),Monitoring event (insert/update/delete),Trigger time
Function:
1. Allow/restrict table modifications
2. automatically generate a derived column, such as an auto-increment Field
3. Forced Data Consistency
4. provide audit and logging
5. Prevent invalid transaction processing
6. Enable complex business
Create and delete a MySQL trigger bitsCN.com
Create and delete MySQL triggers
The following article describes how to create a MySQL trigger and how to delete a MySQL trigger. if you create a MySQL trigger correctly, if you are interested in
Introduction to triggers in Mysql and use cases bitsCN.com
What is a trigger?
A trigger is a database program that monitors a behavior of a data table. Once the behavior of a data table occurs, the corresponding SQL statement is executed
MySQL trigger simple instance bitsCN.com
~~ Syntax ~~CREATE TRIGGER
-- The trigger must have a name and a maximum of 64 characters. it may be followed by a separator. it is similar to the naming method of other objects in MySQL.
{BEFORE |
Automatically generate mysql trigger code for data synchronization bitsCN.com
If there are hundreds of tables in the company to trigger, if you manually write code. Very tired, so today I wrote a small program to automatically generate the mysql
Mysql triggers, fuzzy searches, stored procedures, and built-in functions originally thought that some of Mysql's knowledge was almost the same, but I found that I forgot everything when I used it in projects. Now let's review it and take a note.
This article describes how to learn basic functions and triggers in the MySQL stored procedure, including how to create and delete triggers. For more information, see
Common functions of MySQL stored procedures
I. string type
CHARSET (str) //
· If only the inserted table has data, the current operation is insert;· When both the inserted and deleted tables have data, the current operation is update;· The current operation is delete only when the deleted table has data.CREATE TRIGGER The
Conventions and programming stylesEvery time I want to demonstrate the actual code, I will adjust the code displayed on the screen of the mysql client and change the font to Courier, make them look different from common text so that you can
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.