Update column based on input from another column
Update column based on input from another column
(OP)
In my mysql DB, I have a field (current_) that automatically defaults as the current date/time. This happens each time there is a new entry.
I have another field (next_) that I want to be the current date/time + 4 hours.
I have tried this using code(classic asp) as well as using unix time. Because asp cannot format to yyyy-mm-dd as it is in the DB, this won't work. I cannot use unix time because classic asp has a difficult time converting back to standard date/time from UNIX time.
If there a way to have this script nested, OR RUN AS A STORED PROCEDURE in the DB??
Thanks,
Penguin
Please keep in mind that I am using classic ASP with MySQL database. Not sure if that information helps or not.
I have another field (next_) that I want to be the current date/time + 4 hours.
I have tried this using code(classic asp) as well as using unix time. Because asp cannot format to yyyy-mm-dd as it is in the DB, this won't work. I cannot use unix time because classic asp has a difficult time converting back to standard date/time from UNIX time.
If there a way to have this script nested, OR RUN AS A STORED PROCEDURE in the DB??
Thanks,
Penguin
Please keep in mind that I am using classic ASP with MySQL database. Not sure if that information helps or not.
RE: Update column based on input from another column
The bigger question would be your MySQL's version. If it is 8.0.13 or newer, you can use expression in the default clause :
CODE --> MySQLÂ 8.0.13
If you have older MySQL, you will have to use a trigger :
CODE --> MySQL
Feherke.
feherke.github.io
RE: Update column based on input from another column
---- Andy
"Hmm...they have the internet on computers now"--Homer Simpson
RE: Update column based on input from another column
Thank you, Andy.
Feherke.
feherke.github.io
RE: Update column based on input from another column
---- Andy
"Hmm...they have the internet on computers now"--Homer Simpson
RE: Update column based on input from another column
Exactly that is the most maddening in it : I knew the feature for about 9 years from MSSQL's computed columns.
Feherke.
feherke.github.io
RE: Update column based on input from another column
Thanks,
Penguin
Please keep in mind that I am using classic ASP with MySQL database. Not sure if that information helps or not.