If the def value for a col is (getdate()),
will the col get updated every time anything in that row is changed.... or is it updated only on the initial insert of that row?
I experimented and found that No it doesn't
update a datetime col with the new time every time the column gets changed. You have to do that in your code (for ex in VB LastChanged = (now())
If you want a date field to update every time it is modified (touched), you probably will want to use an update trigger to update the field whenever any data is modified in the table.
Cool! Thanks so much! Is 'inserted' is a pseudo table containing the record that was inserted? Would I also use 'inserted' to reference the ID on a modified record or would that be a 'updated' or some such?
yep, there are two pseudotables, inserted and deleted. THe first holds the new values (in an update) or the new record (In an insert). Deleted holds the old values or the record to be deleted. These pseudotables are only accessible ina trigger.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.