mysql - When I run TIME_TO_SEC to modify a GENERATED column, it throws an error although TIME_TO_SEC works fine independently in a SELECT statement -


i running following mysql script , throws error, tell me wrong?

"alter table class_sessions_archive modify column session_time_computed int(11) time_to_sec(ends_on-starts_on)" 

the error message in mysql remains cryptic, however, paste here:

you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'time_to_sec(ends_on-starts_on)' @ line 1  

all need take difference of 2 dates , store in seconds in new column. made new column , want modify it.

the expression should go in parentheses:

alter table class_sessions_archive     modify column session_time_computed int(11) (time_to_sec(ends_on - starts_on)); 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -