Thread: trigger

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    6
    Rep Power
    0

    Question trigger


    Hi

    Sorry to bother u with most likely a stupid question but im new to sql.

    This is my problem

    I want to copy certain collums from table1 to table2.
    I only want to copy them when this collum in table1tp_goedgekeurd_x003f_ has the value ja
    The names of the collums are the same in table1 and table2.

    This is what i have.

    CREATE TRIGGER test_update_aanvraag
    ON dbo.ows_Project2_u_AanvraagAFDAlgemenezaken
    FOR UPDATE
    IF UPDATE (tp_goedgekeurd_x003f_) == "ja"


    im doing this acces

    THX
    Hellmaster
  2. #2
  3. Modding: Oracle MsSQL Firebird
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2001
    Location
    Outside US
    Posts
    8,527
    Rep Power
    539
    Can't you use a view?
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    6
    Rep Power
    0
    hi
    I tried that but i couldent get it to work.
    this is used with sharepoint team sevices on a intranet
    Last edited by Hellmaster; November 19th, 2003 at 09:04 AM.
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    6
    Rep Power
    0
    OK

    its working partially
    He copys the data between the tables but he also copys the data he did before so he copys them twice and thus gives me double records in the db
    How can i make him check so he doesen copy double items or somethin like that.
    this is what i have now
    INSERT INTO ows_Project2_u_Vrijedagenoverzicht
    (tp_Title, tp_Modified, tp_Created, tp_Author, tp_Editor, tp_Version, tp_EventDate, tp_EndDate)
    SELECT tp_Title, tp_Modified, tp_Created, tp_Author, tp_Editor, tp_Version, tp_EventDate, tp_EndDate
    FROM ows_Project2_u_AanvraagAFDAlgemenezaken
    WHERE (tp_Goedgekeurd_x003f_ = N'ja')

    THX
    Hellmaster
  8. #5
  9. Modding: Oracle MsSQL Firebird
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2001
    Location
    Outside US
    Posts
    8,527
    Rep Power
    539
    You mean you tried a view? Why it didn't work?
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    6
    Rep Power
    0
    HI

    Im working with sharepoint team services and they work with webbots, and i dont know my webbots stuff.
  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    6
    Rep Power
    0
    This is what i have now but now he doesent copy anything anymore ?

    ALTER TRIGGER test_aanvraag_update
    ON dbo.ows_Project2_u_AanvraagAFDAlgemenezaken
    FOR UPDATE
    AS
    INSERT INTO ows_Project2_u_Vrijedagenoverzicht
    (tp_Title, tp_Modified, tp_Created, tp_Author, tp_Editor, tp_Version, tp_EventDate, tp_EndDate, tp_ID)

    SELECT tp_Title, tp_Modified, tp_Created, tp_Author, tp_Editor, tp_Version, tp_EventDate, tp_EndDate, tp_ID

    FROM ows_Project2_u_AanvraagAFDAlgemenezaken

    WHERE (tp_Goedgekeurd_x003f_ = N'ja')

    AND (tp_ID) NOT IN (select tp_ID FROM ows_Project2_u_Vrijedagenoverzicht)

    Hellmaster
  14. #8
  15. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    6
    Rep Power
    0
    GOT it working now with the views and by using only 1 table


    THX
    Hellmaster
  16. #9
  17. Modding: Oracle MsSQL Firebird
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2001
    Location
    Outside US
    Posts
    8,527
    Rep Power
    539

IMN logo majestic logo threadwatch logo seochat tools logo