|  | 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] |