Re: tigger in inserted records

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: joia (joia_at_discussions.microsoft.com)
Date: 06/30/04


Date: Wed, 30 Jun 2004 07:15:02 -0700

this is the trigger, that picks up the inserted string and substrings it to the target table,

CREATE TRIGGER trigger11 ON [dbo].[Fact_Tote_Tmp]
FOR insert
AS INSERT INTO Fact_Tote_ds (Type,Datetime,DecisionpointID, CategoryID, ToteID, WorklistID, DestinationID)
SELECT SUBSTRING(tote_string, 1, 2), substring(tote_string,3,30), substring(tote_string,33,4)stID, substring(tote_string,37,2), substring(tote_string,39,8), substring(tote_string,47,8), substring(tote_string,55,4)
FROM Fact_Tote_Tmp
WHERE tote_string NOT IN (SELECT TYPE+DateTime+DecisionpointID+CategoryID+ToteID+WorklistID+DestinationID FROM Fact_Tote_ds)

"Adam Machanic" wrote:

> What's the trigger doing? Can you post DDL for the table, the code for the
> trigger, and a brief description of what you're trying to accomplish with
> it?
>
>
> "joia" <joia@discussions.microsoft.com> wrote in message
> news:E63FFF8B-94BD-45CC-BA09-DA19CA739A85@microsoft.com...
> > Hi, I have a trigger on inserted records. However, the trigger doesn't
> only work on the newly inserted records, but also on the records that were
> already in the table. How can I make sure that the trigger only works on
> newly inserted records
>
>
>



Relevant Pages

  • Re: Can I Pass a Table Name as a Parameter?
    ... but my understanding is that it only contains inserted records. ... Select * from @TableName ... -Inserted refers to the table the trigger is created on. ... on-board the reasons for avoiding dynamic-SQL if possible. ...
    (microsoft.public.sqlserver.programming)
  • Re: Trigger Question
    ... to get my head around what you mean by set-based code. ... When I insert one record the trigger works fine but when I ... the trigger does work on all inserted records - but it ... do you really have your column and table names in ALL CAPS? ...
    (microsoft.public.sqlserver.programming)
  • Re: Can I Pass a Table Name as a Parameter?
    ... but my understanding is that it only contains inserted records. ... Select * from @TableName ... it would be quite a mess of dynamic SQL pulling various Column names and definition from syscolumns to create more dynamic SQL. ... -Inserted refers to the table the trigger is created on. ...
    (microsoft.public.sqlserver.programming)
  • Re: Can I Pass a Table Name as a Parameter?
    ... but my understanding is that it only contains inserted records. ... -Inserted refers to the table the trigger is created on. ... I have re-read his bit about "Common Cases when to Use Dynamic ...
    (microsoft.public.sqlserver.programming)
  • Re: Trigger Question
    ... >to alter some data in a particular field when records are transferred into ... When I insert one record the trigger works fine but when I ... the trigger does work on all inserted records - but it ... do you really have your column and table names in ALL CAPS? ...
    (microsoft.public.sqlserver.programming)