SQL Server – How to set a datetime field to automatically use current date/time

Senario

You have a ‘datetime’ field in an SQL server database table and need it to automatically use the current date and time when the row is created.

Instructions

  1. Open the database using SQL Management Studio
  2. Right-clicking on the table and selecting ‘Design’
  3. Selected the existing ‘datetime’ field (or creating one)
  4. In the ‘Column Properties’ below, under ‘Default Value or Binding’ enter getdate()
  5. Save the changes to the table

SQL-AutomaticDateTime1