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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

datetime stamp

Status
Not open for further replies.

jldavis5

IS-IT--Management
Jan 22, 2002
9
US
How do I get a datetime stamp on a single record instead of all the records. I have a colum for this with the getdate() formula but everytime I change one record it updates for all the records.
 
A column with a default value of getdate() will get the date and time when a new record is inserted providing you do not insert a value for that column. This value will not change when the row is updated.

Or the INSERT VALUES list could have getdate() for the value. Likewise the UPDATE could set the column equal to getdate() like this
Code:
UPDATE aTable SET useful_data = 'new value',
                  date_changed = getdate()
WHERE key_column = 'value_that_uniquely_identifies_the_row_to_be_changed'

It almost sounds like the WHERE clause is true for all of the rows in your table, but then the useful_data column would also be changed in all of the rows.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top