triggers - Update last modified date column -


i have table this:

id  name    modified 11  john    2016-07-12 15:49:45 22  abraham 2016-07-12 15:52:03 

i need update 'modified' column tracks last modified date row. have done using trigger, have read triggers eat performance. there way using constraints?

it's possible use default constraint , default keyword in update clause. see following example:

create table updatetest (   id int identity,   name varchar(10),   modified datetime2(2) constraint df_modified default (sysdatetime()) )  --id identity, modified default implicitly insert updatetest(name) values('test')  --modified default explicitly update updatetest set name='test2', modified=default 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -