[Originally posted by Yogesh]
ÿ ÿ In my application i m using a date time column for all the tables for keeping track of Modified date time.
I m using SQL Server 7.0
Now I have mentioned a default value in the Defaults pane of the SQL Server Entriprise Manager and bound that default to the modified date time columns.
So now I don't have to mention the value each time in the Insert statement when executing from the front end (VB Client).
But what In case of update statements !!! I have to mention the column and the value isn't it ? Can I do something by which in the update statement also I don't have to specify the column and the value, it should take it System date by default always.
Plz reply urgently.
[Originally posted by Charlie Zimmerman]
You can write a trigger.ÿ The trigger will look something like this:
CREATE TRIGGER UPDATE_DATE ON [dbo].[MYTABLE] FOR UPDATE AS
UPDATE MYTABLE SET LASTUPDATEDATE = getdate() from
WHERE MYTABLE.ID = inserted.ID
In the above, change the following:
MYTABLE -> Your table name
LASTUPDATEDATE -> Name of Date/Time Stamp Field
ID -> Name of Identity Field
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center