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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Triggers

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-03-03 : 07:52:32
Ginny writes "Once or twice a week we run a GL posting. I want to capture the fields DateCreated, CreatedBy and GLDateTime. I want to add them to a table called cstGLPosted.

There can be up to 10,000 records created during this run and the 3 fields I want to capture will be the same for every record, so I only need to capture the info once. Is there a way to create a trigger so that it doesn't repeat info, or would it take more overhead to do it that way. I was also thinking that I could force cstGLPosted to only accept unique records, but I don't know if that will cause the trigger to bomb. What's the best way to go around this?

I have no control over the program that creates the gl records. that's why i'm thinking of using a trigger.

thanks
ginny"

nr
SQLTeam MVY

12543 Posts

Posted - 2004-03-03 : 08:15:04
Why not just run a query after the run to extract the values.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-03-03 : 08:17:23
If it only runs once or twice a week, it would probably be more efficient to run an update afterwards. If all the updates happen in one batch insert though, a trigger wouldn't necessarily be a bad way to go. You could just select the unique out of inserted and insert into your posted table.

You will want to avoid a trigger though if your insert does each post one at a time. It would then definitely be more efficient to do an update after the fact.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page
   

- Advertisement -