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 Yas on 08/16/07 23:05

On 16 Aug, 22:58, Erland Sommarskog <esq...@sommarskog.se> wrote:
> Yas (yas...@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...
>

DOH!!! what a silly mistake. :-) do you think apart from that its fine
for inserting new rows into Table2 from Table1 trigger?

Thanks agian

 

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

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