0

I have one Field Modified On with datetime datatype in sql Table.And the Field is not null.

I need to create trigger for update the Modified on Field while the record will created.

How can I do this??

V.V
  • 875
  • 3
  • 25
  • 54
  • 1
    If you just want to set the date on insert (record creation) then you can use a default value GETDATE() for the modified column. (MS SQL Server) – Tjasun Jul 31 '15 at 06:11
  • @Tjasun I Add Getdate() in default Value or binding. It was working when i create the record.But If I modified the data the Modified column doesn't change. – V.V Jul 31 '15 at 06:24
  • 1
    http://stackoverflow.com/questions/7737945/how-to-create-trigger-for-auto-update-modified-date-with-sql-server-2008 – p w Jul 31 '15 at 07:35
  • Why do you think you need a trigger? Doesn't a default value of CURRENT_TIMESTAMP work? – CL. Jul 31 '15 at 07:37

0 Answers0