Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

holding the lastupdateddate time of a particular record

Status
Not open for further replies.

dnfrantum

Programmer
Oct 23, 2001
175
US
I am importing and appending records to a particular table. Currently I am using GETDATE() to populate the LASTUPDATEDDATETIME field, but it updates the entire table. I really want something like timestamp without the BINARY characteristic. Can someone point me in the right direction to accomplish this task. Specifically, I would like a unique timestamp in varchar or datetime data type for each record.

Thanks in advance,
Donald
 
Try using a trigger, but be careful, updateting the table wich caused the trigger to run can cause the trigger to run again. Look at what recursive triggers are and how to avoig refiring the trigger.
In the trigger you will have an Inserted object which contains al the inserted a modified records. If you have an ID Column in your table, you can have a statement like this

UPDATE Table_1
SET Date = GETDATE()
WHERE
Table_1.ID IN (SELECT ID FROM Inserted)

This will not help you in logging deletes, only update and insert statements.

Iker
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top