25 January 2021

This example shows how to set the default value of a smalldatetime column to current date time.

Source code viewer
  1. CREATE TABLE my_table
  2. (
  3. id BIGINT NOT NULL PRIMARY KEY,
  4. modified_at smalldatetime DEFAULT GETDATE()
  5. );
Programming Language: SQL