Enter now() for datetime in MySQL Workbench



Some years ago, I faced this bug in MySQL Workbench:
  1. Create a table
  2. Add a column with type datetime
  3. Go to the query editor
  4. Try to insert now() into the datetime field
Result: It will not work.

Reason, if you take a look at the query you will see the following:
`test_date`='now()'
Ok, the solution is easy, "now()" must be written without the single quotes. To do this type: 

\func now() 

instead of 

now()

16 comments:

  1. Perfect!! Thanks a lot!!

    ReplyDelete