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

Is there a default sql date_mod column/function?

Status
Not open for further replies.

Qmoto

MIS
Oct 21, 2004
74
US
I have created a simple database along with an import table and script. The import script automatically assigns a datestamp to the datemod field when it's run. This field is being used to identify which records to print.

Recently, users have asked that the datemod field auto update when they modify records in the table. (they are using an access front end to update the data)

As my boss and I were talking about this, I suggested creating a trigger which would fire when certain columns of the table were updated. However, He seemed to think this was overkill and that there must be a column in SQL (2K5) that is automatically populated when a row is updated on the system, and that we could use that data...


Is this true?

If it is true, where would I find that column?

If it's not true, what's the easiest way to break it to my boss that he's wrong? ;0)

 
Are users doing updates through a form or directly in Access' table view?

If they are updating the db through a form, just add
Code:
UPDATE TABLE
set (datemod) = (now())
To your update routine (or work it into your existing update query)

As for how to break it to your boss that there is not some magic column you can query on that doesn't exist in the table, I can't really help you there. I think the 'magic column' is probably the column that you would have the trigger/update statement programmed to update. But no work goes into that, it just happens, right? ;-)

If anyone smarter than me does know of this magical column, please let me know :)

Good Luck,

Alex


A wise man once said
"The only thing normal about database guys is their tables".
 
So... going in and saying "Boss - You're wrong!" Probably isn't the right answer? :0)

-- thanks for the validation, it at least gives me peace of mind (hehehehehehe) --

*ahem*

Back to real life...

Unfortunately the users are changing data directly in table view. Is this going to be a problem for the trigger (and or Access) Do you have any experience with that?

If the rest of this conversation is more suited to the Access forum, just say 'the word' and I'll ask my question over there.

Thanks
Steve





 
I don't work with triggers at all, but I would think they still fire even if a record is changed via access. Not sure if access has an equivalent function, but you would probably want to have your server doing most of the work anyway.

Trigger seems to me like the best bet.

Hope this helps,

Alex

A wise man once said
"The only thing normal about database guys is their tables".
 
Thanks for the help - Guess I'll make the trigger and if it works great, if not, I'll find a way to make it work.

Thanks again,
Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top