Unable to create Default DateTime column in Data warehouse RRS feed

  • Question

  • I am unable to create default datetime column in table of azure data warehouse. we are getting below error message. Please help us to work with same syntax or any alternative for our requirement.

    when we insert data into table [DateTime] column updated with getdate.

    ALTER TABLE users_behaviors_CustomEvent_Prod
      ADD  [DateTime] datetime default (Getdate())

    Msg 104338, Level 16, State 1, Line 193
    An expression cannot be used with a default constraint. Specify only constants for a default constraint.

    Thanks in advance.

    Friday, May 10, 2019 9:03 AM

All replies

  • Hi Raveendra,

    You can not set default constraints in the Azure DW to functions, so you will have to make sure when inserting the data into the table that you insert getdate from your query instead.

    Friday, May 10, 2019 10:26 AM