<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Making a Trigger Fire On Column Change</title>
	<atom:link href="http://benreichelt.net/blog/2005/12/13/making-a-trigger-fire-on-column-change/feed/" rel="self" type="application/rss+xml" />
	<link>http://benreichelt.net/blog/2005/12/13/making-a-trigger-fire-on-column-change/</link>
	<description></description>
	<lastBuildDate>Tue, 18 Aug 2009 22:20:45 -0400</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Manoj</title>
		<link>http://benreichelt.net/blog/2005/12/13/making-a-trigger-fire-on-column-change/comment-page-1/#comment-1156</link>
		<dc:creator>Manoj</dc:creator>
		<pubDate>Thu, 25 Jun 2009 09:50:59 +0000</pubDate>
		<guid isPermaLink="false">http://s194721765.onlinehome.us/blog/2005/12/13/making-a-trigger-fire-on-column-change/#comment-1156</guid>
		<description>Thanks a lot..</description>
		<content:encoded><![CDATA[<p>Thanks a lot..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: breichelt</title>
		<link>http://benreichelt.net/blog/2005/12/13/making-a-trigger-fire-on-column-change/comment-page-1/#comment-578</link>
		<dc:creator>breichelt</dc:creator>
		<pubDate>Wed, 14 Dec 2005 09:33:45 +0000</pubDate>
		<guid isPermaLink="false">http://s194721765.onlinehome.us/blog/2005/12/13/making-a-trigger-fire-on-column-change/#comment-578</guid>
		<description>Karel, you are absolutely correct, I didnt consider updating more than one row, I will note your comment in the post so people will see it, thanks!</description>
		<content:encoded><![CDATA[<p>Karel, you are absolutely correct, I didnt consider updating more than one row, I will note your comment in the post so people will see it, thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://benreichelt.net/blog/2005/12/13/making-a-trigger-fire-on-column-change/comment-page-1/#comment-577</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Wed, 14 Dec 2005 05:45:10 +0000</pubDate>
		<guid isPermaLink="false">http://s194721765.onlinehome.us/blog/2005/12/13/making-a-trigger-fire-on-column-change/#comment-577</guid>
		<description>Hi Ben,

I may be wrong but I don&#039;t think your code will work correctly when updating sets: the inserted and deleted tables are what thet are: tables and not rows.
You are logging the changes to one row, not a set.

The following code works for an update trigger.
You can add similar code for delete and insert statements (or you can change this one to cover the three possibilities)

	INSERT INTO PriceHistory(ItemId, OldPrice, NewPrice)
		SELECT I.ItemId, D.Price, I.Price
			FROM INSERTED I INNER JOIN DELETED D ON I.ItemId = D.ItemId
			WHERE I.Price != D.Price


Kind regards,

Karel Vandenhove</description>
		<content:encoded><![CDATA[<p>Hi Ben,</p>
<p>I may be wrong but I don&#8217;t think your code will work correctly when updating sets: the inserted and deleted tables are what thet are: tables and not rows.<br />
You are logging the changes to one row, not a set.</p>
<p>The following code works for an update trigger.<br />
You can add similar code for delete and insert statements (or you can change this one to cover the three possibilities)</p>
<p>	INSERT INTO PriceHistory(ItemId, OldPrice, NewPrice)<br />
		SELECT I.ItemId, D.Price, I.Price<br />
			FROM INSERTED I INNER JOIN DELETED D ON I.ItemId = D.ItemId<br />
			WHERE I.Price != D.Price</p>
<p>Kind regards,</p>
<p>Karel Vandenhove</p>
]]></content:encoded>
	</item>
</channel>
</rss>

