Add current time to SQL table using SSMS edit mode

How to add current date time to SQL table in edit mode?

That is, in MS SQL, when you right-click on a table and click Edit Top 200 Rows. I would like to fill in the current time in the cell.

GETDATE() or CURRENT_TIMESTAMP does not work.

+5
source share
2 answers

You cannot manually call GETDATE () in edit mode. Instead, add GETDATE () as the default value for the column in design mode and refrain from adding the value to the column in edit mode. Then, SQL Server will add the current date-time as the value.

+4
source

Something is pretty quick and easy here.

In a new query window, execute a SELECT GETDATE() query.

Select the result in the results pane and ctrl-c to copy it to the clipboard.

Then go back to the editing window and paste in the datetime cell.

+10
source

All Articles