Results 1 to 4 of 4

Thread: Trigger

  1. #1
    Join Date
    Aug 2003
    Posts
    328

    Unanswered: Trigger

    Is there some way I can make a trigger in MySQL? I want to put a default date in a date field, and can't figure out how to do it. Thanks.

  2. #2
    Join Date
    Mar 2004
    Posts
    480
    I don't think you can use triggers in MySQL unless it is in version 5.

    But you are only asking to set a default date, can't you set up your table to accept that?

    Code:
    ALTER table mytable 
    change mydate
    mydate date default '0000-00-00'

  3. #3
    Join Date
    Aug 2003
    Posts
    328
    Thanks for your reply. I just get zeros in my date column now.

  4. #4
    Join Date
    Mar 2004
    Posts
    480
    well yes, that would be the default. What date do you want to set to? Use that in place of the 0000-00-00

Posting Permissions

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