Database Reference
In-Depth Information
Figure 7.25
Execute stored procedure.
TASK 4: CREATE AND TEST TRIGGERS
You can create a trigger in the New Query editor. For example, after a student is added or
updated to the STUDENT table, we want to print out an acknowledgment message to dis-
play the completing time of the enrollment.
1. Assume that the Windows Azure SQL Database Management Portal is still open.
Enter the following SQL code in the New Query editor:
CREATE TRIGGER Registration_Info
ON STUDENT
AFTER INSERT, UPDATE
AS
PRINT 'The student is added at' +
RTRIM(CONVERT(varchar(30), GETDATE())) + '.'
2. Highlight the code and click Run . As shown in Figure 7.26, the trigger Registration_
Info is successfully created.
Figure 7.26
Create trigger.
Search WWH ::




Custom Search