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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 trigger for delete and then insert into
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

230 Posts

Posted - 10/14/2012 :  17:38:41  Show Profile  Reply with Quote
I want to create a trigger for the following two codes in table2

First I want to delete table1 (it has 3 columns only).

Then I want to fill up the three columns values from table t which is an output by combining table2 and table3

Table3 is fixed table, Table2 data is deleted in every 3 days and added new data. Every time table2 is added with new data, I want table1 data should be deleted and the following codes to be run.

delete from table1

Second code

insert into table1
select field1, field2 field3 from 
(select field1, field2, field3 from
inner join table3 on table2.field2 = table3.field2)
as t
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000