Sometimes you need to add a CreatedDateTime and ModifiedDateTime columns to your table, here is an easy way to do it...
First create a test table:
Create
(
ID
Col1
CreatedDateTime
ModifiedDateTime
)
Note that the default value for the column CreatedDateTime is Current_Timestamp.
To update the ModifiedDateTime column we need this trigger:
As
Update
From
On
Now Test:
Insert
Select
ID Col1 CreatedDateTime ModifiedDateTime
----------- ------------------- ----------------------- -----------------------
1 Hello 2007-12-16 22:18:39.013 NULL
Remember Me
a@href@title, strike
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.