Trigger Problem

  • Hello,

    Does anyone know how to get a trigger to fire while you are uploading multiple records into a SQL Server 2005 Express DB using the DTS Wizard?

    On insert of a person's record I want the trigger to find their id# from another table and update their information accordingly.

    I have the trigger built, but it will not fire when I use the DTS Wizard.

    my trigger is..........................

    CREATE TRIGGER TRIG_AH_PRE_REQUEST_DETAILS

    ON AH_PRE_REQUEST_DETAILS

    after insert

    AS

    BEGIN

    declare @pin_nRequestID int,@nSMSCount int

    select @pin_nRequestID= nRequestID from inserted

    select @nSMSCount= total from(

    select count(*) as total from AH_PRE_REQUEST_DETAILS

    where nRequestID=@pin_nRequestID

    ) a

    update AH_PRE_REQUEST set nSMSCount=@nSMSCount

    where nRequestID=@pin_nRequestID

    END

    here first on record inserted that is detais record in the table AH_PRE_REQUEST

    that record is P.K

    then based on the record

    bulk inserted int table AH_PRE_REQUEST_DETAILS some 50

    then automatically update the

    main table count=50

    based on the P.K

    how to write the trigger

    plz help meee..................................

  • Bulk imports usually disable triggers. I don't think there's an option to bypass that in the Import Wizard (could be wrong, take a look for something like that).

    If not, you'll need to change how you're doing the import process. What are you importing?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply