If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
getting record to automatically put in default date
is there something similar to "timestamp" column type or a way of having a "date" field automatically insert today's date when the record is created. I want it to do something similar to "timestamp" but i don't want it to change everytime the record is edited/updated. It would just be something like a record creation date. any help would be appreciated. thanks.
Add a date column to the table and assign a default value to it.
Then you don't mention it in the INSERT statement, but it gets filled with that default.
default value: SQL Server getdate()
Oracle sysdate
MySQL ??
I'm more into SQL Server and Oracle, so I don't know het 'now'-function
in MySQL.
From what i've read in the mysql manual "timestamp" behaves differently whether or not mysql is in maxdb mode or not. if in maxdb mode the timestamp will not update to current date/time when the record is updated.
i need to have two columns in my tables. one field that will have a record creation date/time that is defaulted to current date when record is created only. then the second date field will update to current date/time whenever the record is changed. is this possible? i need a solution that will work in maxdb mode or not. why would mysql change the way the 'timestamp' field type behaves depending on maxdb mode or not?
did i understand the mysql manual correctly that the 'timestamp' field updates or does not update on a record change depending on whether maxdb is enabled?
"In addition, if the MySQL server is running in MAXDB mode, TIMESTAMP is identical with DATETIME. That is, if the server is running in MAXDB mode at the time that a table is created, any TIMESTAMP columns are created as DATETIME columns. As a result, such columns use DATETIME display format, have the same range of values, and no automatic updating occurs. "
so if you want automatic timestamp updating, don't run in maxdb mode, is the conclusion i would draw from that