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.
Author |
Topic |
bi89405
Starting Member
35 Posts |
Posted - 2013-04-06 : 23:53:33
|
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
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-04-07 : 21:00:30
|
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). |
|
|
|
|
|