Quote:
learning SQL server for free from SQL server videos shared by my friend
I've not yet been able to find a video that conveys sufficient information on technical topics
by itself. If you are going to use them at all, use them in conjunction with other resources, such as articles and tutorials. There are many free ones available e.g.
The Comprehensive Guide to SQL Triggers[
^]
Quote:
because I can't afford the training fee.
Have you looked at cheaper alternatives such as Pluralsight, LinkedIn Learning, A book? There are also several articles here on Code Project, all free - see this site
Search[
^]
Quote:
but it seems not working
This is the least helpful bit of information that new members give us. It tells us exactly nothing about your problem. Be specific - is an error thrown? What values are returned (and what values were you expecting). On that note, well done for providing sample data.
I can warn you about one thing - your trigger is assuming that only one row at a time can be altered - this may not be the case - learn about Transactions and remember that SQL is a set-based language, you rarely need cursors or loops (see
Processing Loops in SQL Server[
^] )