How can I add the current date time to a SQL table in edit mode?
That is, in MS SQL, when you do right click on a table and click on Edit Top 200 Rows. I would like to fill current date time in the cell.
GETDATE()
or CURRENT_TIMESTAMP
does not work.
The simplest method to insert the current date and time in MySQL is to use the now() function. Once you call the function, it returns the current date and time in the system's configured time zone as a string. The value returned from the now() function is YYYY-MM-DD for the date and HH-MM-SS-UU for the time record.
SQL Server GETDATE() Function The GETDATE() function returns the current database system date and time, in a 'YYYY-MM-DD hh:mm:ss.
Here's something fairly quick and easy.
In a new query window execute the query, SELECT GETDATE()
.
Select the result in the result pane and ctrl-c
to copy it to the clipboard.
Then go back to your Edit window, and paste into the datetime cell(s).
You can't manually call GETDATE() in edit mode. Instead, add GETDATE() as the default value for the column in design mode, and refrain from adding a value to the column in edit mode. Then SQL Server will add the current date-time as the value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With