This project explores scalar functions and after-update triggers in SQL Server using a practical, step-by-step approach. The project is split into two parts:
Focus: Extract first and last names from the ContactName column in the t_w3_schools_customers table.
Scripts:
s1tos8: from question to testing and function creation.
Functions Created:
dbo.fn_GetFirstNamedbo.fn_GetLastName
Focus: Automatically update audit fields (LastModifiedBy, LastModifiedDate) after a record is updated.
Scripts:
s1tos6: from initial question to a working trigger with test case.
Trigger Created:
trg_UpdateCustomerAudit
- CHARINDEX – Microsoft Docs
- LEFT – Microsoft Docs
- AFTER UPDATE Trigger – SQL Server Tutorial
- CREATE TRIGGER – Microsoft Docs
Coming soon – includes live demonstrations of all steps above.
Ernest Baah Dwomoh
BYU Pathway Student
April 2025