Database Reference
In-Depth Information
Figure 7.27
Message sent by trigger.
3. To test the trigger we have just created, we add a new student to the STUDENT table
with the student id 19, and the name Mark Tyler with the following SQL statement:
INSERT INTO STUDENT(StudentID, FirstName, LastName)
VALUES (19, 'Mark', 'Tyler')
4. Highlight the code and click Run . As shown in Figure 7.27, the trigger Registration_
Info returns a message to indicate that the student is added. However, as seen in the
message, it needs a space between the words at and Jul .
5. You can use the ALTER TRIGGER statement to modify the existing trigger. To add
a space between at and Jul in the message, use the following statement:
ALTER TRIGGER registration_info
ON STUDENT
AFTER INSERT, UPDATE
AS
PRINT 'The student is added at ' +
RTRIM(CONVERT(varchar(30), GETDATE())) + '.'
Figure 7.28
Alter trigger.
Search WWH ::




Custom Search