Computerised Date

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • oskelton
    New Member
    • Jul 2008
    • 2

    Computerised Date

    Hi,

    Is it possible to have a date stamp auto created in a SQL table on Insert? I have a 3rd party software that can update a 3rd party database (i.e. my sql database), but it has no option to add the current date/time when inserting a new row into the table, hence I'd like sql to automatically populate the date/time in the column when the row is created.

    I've tried using GETDATE() in 'Computer Column Specification', but when the column is set to 'Is Persisted' the table can't be saved due to the error ' the column is non-deterministic' - this is apparently by design.

    Is there any other options to auto generate a datetime in a column on insert of a row?

    Thanks
    Oli
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Alter your table and add a new column, say DLUP (Date of Last Update). Set the default value to GETDATE()

    -- CK

    Comment

    • oskelton
      New Member
      • Jul 2008
      • 2

      #3
      Can't believe I missed that!... Great, did the job.

      Thanks

      Comment

      Working...