﻿<?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 2008 / SQL Server 2008 - General  / after insert update from another table / 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>Thu, 23 May 2013 00:54:08 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: after insert update from another table</title><link>http://www.sqlservercentral.com/Forums/Topic1421381-391-1.aspx</link><description>Believe what you may be looking for is the MERGE statement.  For a discussion and example of how it works:[url]http://www.simple-talk.com/sql/learn-sql-server/the-merge-statement-in-sql-server-2008/[/url]If you would/could post the table definition, some sample data and desired result someone may be able to assist you with tested sample T-SQL.To provide the sample as I suggested please click on the first link in my signature block and read the article.  The article has sample T-SQL to allow you to post the table definition, some sample data and desired result simply and easily.</description><pubDate>Mon, 18 Feb 2013 18:59:52 GMT</pubDate><dc:creator>bitbucket-25253</dc:creator></item><item><title>after insert update from another table</title><link>http://www.sqlservercentral.com/Forums/Topic1421381-391-1.aspx</link><description>newbie here...can't seem to get this to function properly, tried creating many variants of standalone triggers and triggers calling a stored procedure passing variables.  During testing, all of the records in one table get updated instead of only one.  Here's my scenario in MSSQL2008:table1 with 5 columns, column1 is primary key int, col(2,3,4 &amp; 5) are varchar(25)table2 has the exact same columnswhen a record is inserted into table1,1)lookup the matching record in table2 where the datavalue in table1.column2 = datavalue in table2.column22)then update columns 3, 4 &amp; 5 in the inserted record (table1) with the data from result set from their matching columns in table2, ie. where table1.3=table2.3, table1.4=table2.4,  table1.5=table2.5;3)only use the newest record in table24)only update the newly inserted recordAny help would be great, thanks.</description><pubDate>Mon, 18 Feb 2013 17:05:59 GMT</pubDate><dc:creator>cts_account</dc:creator></item></channel></rss>