Hi, I would like to add something like "now()" as a default for new entries? Is this possible? So basically when a new record is entered in will time\date stamp. I tried adding "now()" but just returns null.. THanks
Hi, What about something like this, I believe it's used when creating the table? ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP Also what happens when you try: SELECT Now() Do you get the current date/time? I am not sure if it will work or not, but there is some info on the following site that might help: http://dev.mysql.com/doc/refman/5.0/en/timestamp.html Good luck! Tim
Are you adding Now() as the value in your query or seting it as a default for the field? From what I have read (but not tested as I use MSSQL) you cannot use a nonconstant expression as a default value. The exception to this is to use timestamp. (http://dev.mysql.com/doc/refman/5.0/en/timestamp.html) Be careful about using timestamp because it has some properties that may make it work in a manner you do not want it to if you do not set it up correctly (such as updating each time the record is updated). You could also try adding Now() to the query or pulling the datetime from your coding language. Looks like Tim got to it as I was writting.
I had the data type as "datetime". When I changed to "timestamp" and changed the default value to "CURRENT_TIMESTAMP" it worked - thanks!