SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Triggers
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

bi89405
Starting Member

USA
35 Posts

Posted - 04/06/2013 :  23:53:33  Show Profile  Reply with Quote
Hello,

I am fairly new to using triggers. I have a straightforward question. I have a staging table that gets loaded every day by deleting everything in there first then reloading the data from the source file. I would like to create a trigger that insert only certain accounts to table2. I created an trigger with insert after option but I get lots of duplicate records in table2. Can someone please assist here?

Thanks,
ZH

James K
Flowing Fount of Yak Knowledge

3578 Posts

Posted - 04/07/2013 :  21:00:30  Show Profile  Reply with Quote
Since the problem appears to be in the logic of your trigger code, if you can post the code that you are using that would enable someone to suggest solutions.

When I need to load data from a staging table to the production table, I don't use triggers. I set up another job/query that picks up the rows from the staging table and inserts/updates/deletes as required from the production table. Usually it is best to reserve triggers for light-duty tasks, and only when required (for example auditing).
Go to Top of Page
  Previous Topic Topic Next Topic  
 New 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.06 seconds. Powered By: Snitz Forums 2000