0

I have the following columns on a MSSQL 2014 database table:

Created datetime not null
  constraint DF_Post_Created default getutcdate(),  
Modified datetime not null

Can I make Modified to change every time the row is updated?

I think default getutcdate is only for when the row is created, right?

SubqueryCrunch
  • 1,325
  • 11
  • 17
Miguel Moura
  • 36,732
  • 85
  • 259
  • 481
  • You need to use an update trigger for that. Usually, it's more reasonable to simply always update it manually, though (just add `Modified = getutcdate()` to all your updates). – Luaan Oct 16 '14 at 11:13
  • default will work on inserting new records.. You need to use tringgers – Roshan Nuvvula Oct 16 '14 at 11:14
  • Duplicate of http://stackoverflow.com/questions/7737945/how-to-create-trigger-for-auto-update-modified-date-with-sql-server-2008 – Recursive Oct 16 '14 at 11:15

0 Answers0