i need example of SQL Server Update Trigger, Get fields before and after updated
to execute sql statments in another table
i need example of SQL Server Update Trigger, Get fields before and after updated
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
SQL Server triggers have access to 2 “magic” tables that contain a row for each row that was inserted, updated, or deleted in the statement that caused the trigger to execute.
To find all of the inserted rows on a INSERT statement:
For all of the deleted rows on a DELETE statement:
For UPDATE statements, each row updated will be present in both the inserted and deleted tables. The inserted table will hold the new value of the row after the update statement, and the deleted table will hold the old value of the row just before the update statement. Join between the two tables to get what you need: