Hard to fill in DateTime fields

w00kie's profile image w00kie posted 1 week ago in General Permalink

For DateTime fields, I want to be able to default to the current DateTime, or enter something like NOW() when editing a row. I found this issue which discusses a setting to handle this:

https://www.heidisql.com/forum.php?t=10103

However, this says that it only works with NULLs. If I duplicate a row that already had a value and then make it blank, I get 0000-00-00 00:00:00 in the DateTime field.

ansgar's profile image ansgar posted 7 days ago Permalink

You can press Ctrl/F2 to go into function mode in a cell, or rightclick > Insert value > SQL function:

Description

That lets you write any SQL function like NOW() or whatever into the field.

Alternatively, in the same menu, there is a "Date and time" item with the current time to click on.

ansgar's profile image ansgar posted 7 days ago Permalink

Another thing you might not have enabled is this one:

Description

This sets the current time into an edited field if it's null.

Please login to leave a reply, or register at first.