You are here: Re: MS SQL copy new and modified rows from TABLE1 to TABLE2 « MsSQL Server « IT news, forums, messages
Re: MS SQL copy new and modified rows from TABLE1 to TABLE2

Posted by Erland Sommarskog on 08/16/07 21:58

Yas (yasar1@gmail.com) writes:
> CREATE TRIGGER my_Trigger ON [dbo].[Table2]
> FOR INSERT
> AS
>
> INSERT INTO
> Table2(STATUS,attribute15,email,lastname1,lastname2,name,company,startDate)
> SELECT 'Active' AS STATUS, b.Attribute15, b.email, b.lastname1,
> b.lastname2, b.name,
> b.company, b.startDate
> FROM Inserted b LEFT OUTER JOIN
> Table2 a ON b.Attribute15 = a.Attribute15
> WHERE a.Attribute15 IS NULL
> GO
>
> The syntax according to MS SQL server is correct but nothing happens
> when a new row is inserted into Table1.

Well, the code you posted is a trigger on Table2, so...


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация