﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2005 / T-SQL (SS2K5)  / If Update() in a trigger / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Tue, 18 Jun 2013 00:58:46 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: If Update() in a trigger</title><link>http://www.sqlservercentral.com/Forums/Topic1360457-338-1.aspx</link><description>Yup. You want changed, you need to compare the columns in the inserted and deleted tables.</description><pubDate>Tue, 18 Sep 2012 06:04:08 GMT</pubDate><dc:creator>GilaMonster</dc:creator></item><item><title>RE: If Update() in a trigger</title><link>http://www.sqlservercentral.com/Forums/Topic1360457-338-1.aspx</link><description>Gotcha, not CHANGED just UPDATED.</description><pubDate>Tue, 18 Sep 2012 05:58:20 GMT</pubDate><dc:creator>dean.giberson 64357</dc:creator></item><item><title>RE: If Update() in a trigger</title><link>http://www.sqlservercentral.com/Forums/Topic1360457-338-1.aspx</link><description>Not quite...It's checking whether ColumnA was one of the columns specified in the SET clause of the update statement.UPDATE Tbl SET ColumnA = ColumnAIf you had an update trigger on Tbl checking for UPDATE(ColumnA), it would be true for that update statement, even though no rows have the value of ColumnA changed.</description><pubDate>Tue, 18 Sep 2012 05:54:07 GMT</pubDate><dc:creator>GilaMonster</dc:creator></item><item><title>RE: If Update() in a trigger</title><link>http://www.sqlservercentral.com/Forums/Topic1360457-338-1.aspx</link><description>Thanks for the reply.  So I am clear on the answer, whatever the processing is between the begin and end will be executed because the system is only checking if column A has been updated for any of the rows in the inserted table so even if only one of the 10 rows had column A updated all 10 rows would still be processed.  Am I correct?</description><pubDate>Tue, 18 Sep 2012 05:37:16 GMT</pubDate><dc:creator>dean.giberson 64357</dc:creator></item><item><title>RE: If Update() in a trigger</title><link>http://www.sqlservercentral.com/Forums/Topic1360457-338-1.aspx</link><description>[quote][b]dean.giberson 64357 (9/17/2012)[/b][hr]I have a question that I thought I knew the answer to but I am now not sure.  When in a trigger, suppose there are 10 rows in the inserted table. 3 rows have one column(call it A) updated and 7 rows have another column (call it B) updated.  If code is entered in the trigger that states If Updated(A) begin ... end will the actions between the begin and end be executed on all 10 rows or only the 3 with the column A updated?[/quote]In a single insert or update of all 10 rows for the above, all 10 rows will respond to the IF UPDATED(A) because IF UPDATED() simply checks to see if anything in the whole column for the whole statement was affected.</description><pubDate>Mon, 17 Sep 2012 18:32:26 GMT</pubDate><dc:creator>Jeff Moden</dc:creator></item><item><title>RE: If Update() in a trigger</title><link>http://www.sqlservercentral.com/Forums/Topic1360457-338-1.aspx</link><description>A trigger fires once only for an operation. All the rows affected by the insert/update/delete will be in the inserted and/or deleted tables.</description><pubDate>Mon, 17 Sep 2012 15:06:51 GMT</pubDate><dc:creator>GilaMonster</dc:creator></item><item><title>If Update() in a trigger</title><link>http://www.sqlservercentral.com/Forums/Topic1360457-338-1.aspx</link><description>I have a question that I thought I knew the answer to but I am now not sure.  When in a trigger, suppose there are 10 rows in the inserted table. 3 rows have one column(call it A) updated and 7 rows have another column (call it B) updated.  If code is entered in the trigger that states If Updated(A) begin ... end will the actions between the begin and end be executed on all 10 rows or only the 3 with the column A updated?</description><pubDate>Mon, 17 Sep 2012 14:50:01 GMT</pubDate><dc:creator>dean.giberson 64357</dc:creator></item></channel></rss>