Skip navigation
Currently Being Moderated

Timestamp in database for new row

May 23, 2012 3:43 PM

I have a timestamp field in my db.
In my mysql program I clicked on the box that says "On Updated Current_Timestamp" which works fine for updating rows in the database and adds the time.
Now I want it to add the time for NEW rows, so in the default box I put now();  but I get an sql error. I am doing it in the database to lessen the load on coldfusion but maybe something like this is better in my cfquery insert into sql?:

 

<cfqueryparam cfsqltype="cf_sql_timestamp" value="#now()#" />

 

What do you think I should do? Thanks

 
Replies
  • Currently Being Moderated
    May 23, 2012 5:57 PM   in reply to goodychurro1

    What is the code you are running and what is the error?

     
    |
    Mark as:
  • Currently Being Moderated
    May 24, 2012 9:13 AM   in reply to goodychurro1

    I did a google search on "mysql now" and found this page.  http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html

     

    I noticed one synonym for now is current_timestamp().  I'd try that with a 0 in the brackets.

     
    |
    Mark as:
  • Currently Being Moderated
    May 24, 2012 9:51 AM   in reply to goodychurro1

    Since I don't actually use mysql, and nobody else has answered, you might have better luck on a mysql forum.

     
    |
    Mark as:
  • Currently Being Moderated
    May 24, 2012 10:28 AM   in reply to Dan Bracuk

    It it is truly a timestamp field, there should be no need for a default value... no?

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points