SQL creation triggers
Create TRIGGER syntax
Create Trigger Triggername on TableNameFor Insert |delete|updateAsBegin
End
Come on, look at that. Create an instance of a trigger
CREATE TABLE Ta1(Taid int Identity (1001,1) primary key,Taname
We update the MySQL datasheet real-time trigger SQL Server in the corresponding table of additions and deletions, first of all, add the original MySQL table triggers, including the following three:Insert data:Delimiter | |DROP TRIGGER IF EXISTS
emule resources can also be downloaded with thunder
The following is a list of files that are shared by users, and you can download them by clicking on them after you install emule
[0 Basic science sql.server.2005
This paper mainly deals with the application examples of DDL triggers and login triggers.
MicrosoftSQL Server provides two primary mechanisms for enforcing business rules and data integrity: constraints and triggers. Triggers are special types of
A. Build a library, build a table, and add constraints.
1.1 Building the Library
Copy Code code as follows:
Use master
Go
if exists (SELECT * from sysdatabases where name= ' MyDatabase ')-Determine if there is a database name
One, what triggers
1, personal understandingTriggers, which are literally understood, a hair-trigger device, a trigger (haha, personal understanding), for example, like when it's dark, you turn on the light, you see something. You put the
This article mainly introduces the triggers in MySQL, including the use of triggers to add, update, delete users and other operations, the need for friends can refer to the
In many cases, it's better to be clear than to think. The program should be
1. Basic Guidelines
When creating trigger, follow these guidelines
A. The name of the trigger, the character length of the CREATE trigger statement text cannot exceed 32KB
B. Name of the topic table
C. Time of trigger activation (after execution
server|sqlserver| Triggers | creating
The following describes how to create triggers using SQL Server Administration Tools Enterprise Manager and Transaction_sql in MS SQL Server.You must consider the following aspects before creating triggers:The
The trigger--it's all my understanding of the trigger.When you do the INSERT, delete, and so on, do some extra work,For example, adding new data to the inserted table when it is addedWrite an exampleInsert into UserInfo (Name) output inserted. Id
the step problem of MySQL self-increment column
Unique index and Federated unique
Variants of foreign keys
SQL data row additions and deletions change
View
Trigger
Function
Stored Procedures
Transaction
1. Database Connection Table1.1, a pair of moreUse foreign keys to make constraints. Note: The data types of the foreign key columns are consistent.Commands to create foreign keys in the same wayCREATE Table Part1 (Nid int not NULL auto_increment
Trigger Simple to understandTrigger (Trigger): Monitors a situation and triggers an action, which is a special stored procedure related to a table event, which is executed either by a program call or by a manual startup, but by an event, such as
When single-table data is too long. We can divide the level, the SQL Server partitioned view to achieve a horizontal table, horizontal division can improve some of the performance of the table.The vertical sub-table is relatively rare to see and use,
SQL ViewIn SQL, a view is a table of visualizations based on the result set of an SQL statement.The view contains rows and columns, just like a real table. A field in a view is a field from a real table in one or more databases. We can add SQL
MySQL includes support for triggers. A trigger is a database object associated with a table operation that invokes the execution of a trigger on a table when a specified event occurs on the table on which the trigger is located.Create a TriggerIn
Stored procedure: Just like a functionstored in the database--"programmability--" storage proceduresTo create a stored procedure:Create proc Jiafa--Required parameters@a int,@b intAs--contents of the stored proceduredeclare @c int;Set @c = @a +
One, stored proceduresThe basic format of the stored procedure is as follows:--declaration Terminator--create a stored procedureDELIMITER $--declaring the terminator of a stored procedureCREATE PROCEDUREPro_test ()--stored procedure name (parameter
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.