Forum Replies Created

Viewing 15 posts - 16 through 30 (of 101 total)

  • RE: after insert trigger

    UFFF! ive made it...after a lot of effort.

    thanks for your help.

    now i share.

    alter TRIGGER trgAfterInsert ON eicanalesres

    FOR INSERT

    AS

    declare @contrato decimal (10,0);

    declare @canal decimal (10,0);

    declare @servidor datetime;

    declare @maquina datetime;

    declare @corregida...

  • RE: after insert trigger

    Michael L John (9/9/2010)


    Can you post the original insert statement/procedure that performs the first insert?

    It's probably will be something like:

    INSERT INTO Table (field, field,...)

    VALUES(x, y, ...)

    If x = 91 and...

  • RE: after insert trigger

    Michael L John (9/9/2010)


    You said:

    I want a new record that takes all the data from from the recently inserted record where idcontrato =2 and eicanalid =91. And then give this...

  • RE: after insert trigger

    Lowell (9/9/2010)


    lets try something different...show us what you think the INSERT INTO statement would look like;

    your requirement changed form updating colA and colB to something different....all the clues for your...

  • RE: after insert trigger

    Lowell (9/9/2010)


    igngua (9/9/2010)


    if i do an instead of trigger that would delete the original record. I dont want the original record to be deleted. I want a new record that...

  • RE: after insert trigger

    Michael L John (9/9/2010)


    A trigger certainly does not seem to be the best method to use to accomplish what needs to be done.

    why?

  • RE: after insert trigger

    any ideas?

  • RE: after insert trigger

    Lowell (9/9/2010)


    if the three columns make the row unique, why are you changing one of the values? a trigger like that should change columns other than those comrising the primary...

  • RE: after insert trigger

    Ok it seems i´ve not been the only with this problem.

    I found on the web the following;

    create table fred

    (fredId int primary key,

    value varchar(10))

    go

    create trigger fred$insertTrigger

    on fred

    after insert

    as

    update fred

    set fredId...

  • RE: after insert trigger

    Lowell (9/9/2010)


    update dbo.eicanalesres

    SET idcontrato = '13'

    FROM INSERTED

    WHERE dbo.eicanalesres.IdContrato = INSERTED.IdContrato

    AND dbo.eicanalesres.EiCanalId = INSERTED.EiCanalId

    AND dbo.eicanalesres.EiFechServ = INSERTED.EiFechServ

    AND inserted.idcontrato = '02'

    AND inserted.EiCanalId = '91'

    and inserted.eifechserv = eicanalesres.eifechserv

    you missed the core...

  • RE: after insert trigger

    any ideas??

  • RE: after insert trigger

    Ok...after triying and triying this is closer to an answer but it still goes wrong.

    ALTER TRIGGER [dbo].[datosdemo]

    ON [dbo].[EICANALESRES]

    AFTER INSERT

    AS

    BEGIN

    SET NOCOUNT ON;

    ...

  • RE: after insert trigger

    Thanks lowell.

    Ive tried it on a hurry while leaving work. Ill post back if something goes wrong.

  • RE: after insert trigger

    Lowell (9/7/2010)


    igngua (9/7/2010)


    thanks!!

    im using this one because the other one cant get updated.

    Ive a question if you excuse my 'newbieness', what does 'id' means.

    i had to infer a lot...

  • RE: after insert trigger

    Lowell (9/7/2010)


    the core of the trigger is going to be something like this, but you didn't provide all the info needed. what values would col1 and col2 actually be assigned?

    ...

Viewing 15 posts - 16 through 30 (of 101 total)