Results 1 to 3 of 3

Thread: [RESOLVED] create trigger

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2006
    Location
    Aurangabad
    Posts
    25

    Resolved [RESOLVED] create trigger

    Hi Everybody i want to create trigger in sql server 2008 database
    i want to insert data into another table in same database after parent database inserted record

    i am trying something like this

    CREATE TRIGGER INS_LOGDATA
    ON NGAC_AUTHLOG
    AFTER
    INSERT
    (select Userid,Transactiontime from NGAC_AUTHLOG )
    AS Insert into LOGDATA values (Userid,ActDate,ActTime) values (Userid,ActDate,ActTime)
    Last edited by deshpandesn; Oct 18th, 2011 at 01:40 AM. Reason: additional information

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: create trigger

    Thread moved to the 'Database Development' forum

  3. #3
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,969

    Re: create trigger

    It would be something like this:

    INSERT LOGDATA(Userid,ActDate,ActTime)
    select Userid,Transactiontime,ActTime from inserted

    You'll need to resolve the column names from inserted (which are what is in NGAC_AUTHLOG) to the names in LOGDATA

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width