Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Creating A Trigger in SQL SERVER 2005

Author  Topic 

tempora101
Starting Member

1 Post

Posted - 2011-09-11 : 22:54:15
I am very new to SQL SERVER, but I need to create a trigger that deletes ans inserts records into two table based on an action on a third table.

The logic works as below

Upon add, update or delete action on table A, perform the following operations:

select * from "table_B" delete from "table_B"

INSERT INTO "table_B" SELECT "table_c.Column1", "table_c.Column2", "table_c.Column2" from "table_c"

select * from "table_D" delete from"table_D"

INSERT INTO"table_D" SELECT "table_e.Column1", "table_e.Column2", "table_e.Column2" from "table_e"

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-12 : 01:02:42
sorry didnt get that. howzz tableC and tableD related to A? how do you determine what all to be inserted/deleted from these tables based on DML operation in A?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -