Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2004
    Posts
    191

    Unanswered: Help with Trigger

    I would like to create a trigger on just one field within table docmaster. Please help. Thanks


    CREATE TRIGGER trgInsert

    ON MHGROUP.docmaster

    FOR INSERT

    AS

    Print ('Preset Default Cannot Be Entered In This Field!')

    GO

  2. #2
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    outer join to both inserted and deleted. in an update the new data is in the former and the old data is in the latter. compare the field in both tables to eachother and perform the action if they differ.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  3. #3
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Quote Originally Posted by milan1115
    I would like to create a trigger on just one field within table docmaster.
    So exactly what do you want the trigger to do? Your error message looks to me like you've got a default value, and you don't want the users to change back to that default after they've used a different value.

    I'm not very good at "specification charades", but I'll try to play for a round or two in order to help get the party started!

    -PatP

Posting Permissions

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