473,569 Members | 2,756 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

last update

Ike
Is there a way in mysql to discern when the last date/time a field, row, or
table was been updated or inserted? Thanks, ike
Jul 23 '05 #1
4 3253
>Is there a way in mysql to discern when the last date/time a field, row, or
table was been updated or inserted? Thanks, ike


Maybe, for rows. A timestamp field (well, the first one) is
automatically set to the current time when the row is modified, or
when the row is created, UNLESS it is explicitly set to another
time other than null. So if you handle it properly, you've got a
row-last-modified-time field. Insert it as null (or leave it out
of the field list), and don't update it at all. It will be maintained
for you. But it is easy to fake it by explicitly setting that field
to something else.

Table modification times are available with SHOW TABLE STATUS.
These may be more recent than expected due to things that might not
be considered modifications, like OPTIMIZE TABLE, which doesn't
really change any of the data.

There's no place to store a modification time for every field, and
no automatic way of updating them, unless you use triggers (available
in MySQL 5.0). Then you could have an automatically-maintained
update log (field FOO of table BAR changed from %s to %s at <time>
by <user>) in another table used to track the changes.

Gordon L. Burditt
Jul 23 '05 #2
Ike

"Gordon Burditt" <go****@hammy.b urditt.org> wrote in message
news:11******** *****@corp.supe rnews.com...
Is there a way in mysql to discern when the last date/time a field, row, ortable was been updated or inserted? Thanks, ike


Maybe, for rows. A timestamp field (well, the first one) is
automatically set to the current time when the row is modified, or
when the row is created, UNLESS it is explicitly set to another
time other than null. So if you handle it properly, you've got a
row-last-modified-time field. Insert it as null (or leave it out
of the field list), and don't update it at all. It will be maintained
for you. But it is easy to fake it by explicitly setting that field
to something else.


How would you access that value Gordon? Thanks, Ike
Jul 23 '05 #3
Ike

"Ike" <rx*@hotmail.co m> wrote in message
news:6Z******** *********@newsr ead2.news.pas.e arthlink.net...

How would you access that value Gordon? Thanks, Ike


Whoops, my mistake - I assumed MySQL kept a value for that outside your own
table. I see now that you meant adding a TIMESTAMP field to the table.
Thanks again, Ike
Jul 23 '05 #4
>> >Is there a way in mysql to discern when the last date/time a field, row,
or
>table was been updated or inserted? Thanks, ike


Maybe, for rows. A timestamp field (well, the first one) is
automatically set to the current time when the row is modified, or
when the row is created, UNLESS it is explicitly set to another
time other than null. So if you handle it properly, you've got a
row-last-modified-time field. Insert it as null (or leave it out
of the field list), and don't update it at all. It will be maintained
for you. But it is easy to fake it by explicitly setting that field
to something else.


How would you access that value Gordon? Thanks, Ike


With a SELECT, just like any other field.

YOU have to put that field in the table; it's not a magic field
with a magic name that's always there.

Gordon L. Burditt
Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
8572
by: pg | last post by:
Is there any simple way to query the most recent time of "changes" made to a table? I'm accessing my database with ODBC to a remote site thru internet. I want to eliminate some DUPLICATE long queries by evaluating whether the data has been changed since last query. What should I do? -Jason
11
12465
by: David Messner | last post by:
Ok I know this is simple but the statement eludes me... I have a date field where I want the default value on the data entry form's date field to be the last date entered. I figure I can do this with a query but don't know what the criteria needs to be. Any help would be appreciated, Thanks
1
2925
by: BLUE WATER | last post by:
Does anyone know how I can see a value in my form field text box ? I tried to add a text box, but the record source doesn't list the variable I want to see for each record. The variable is the Last Updated Date for that given record. How do I get it to show ? I also tried
12
1942
by: savedelhi | last post by:
Hi, I'm a relative newby and have a tricky problem in Access 2002. I have a continuous form with a check box called "Select". (I now know I shouldn't have called it that but it's way too late to change now). I've set up a command button to changes the check box from Yes to No with the following code:-
0
1374
by: Bob | last post by:
Background 1. I create a data table that has one primary key and one unique column with other columns as well 2. I then Bind it to my list countrol setting the DataSource to my table name and my display column t my Primary key column 3. When I need to update the table, I use a Begin Update on the row 4. Make my changes to the non key...
5
2422
by: John Veldthuis | last post by:
My code works perfectly 100% when adding items to my ArrayList and updating the listbox. Works perfectly when deleting an item in the ArrayList when it is not the last entry but if it is the last entry and you select another index it goes boom!!!. Funny thing is the SelectedIndex Changed routine fires off perfectly and then crash after the...
7
16110
by: Boxwar | last post by:
Hi, I am creating a Python function which contains a SQL string. When the function is loaded, the SQL table must be updated with the values from my program. This is all done. Though I'm stuck at the SQL string. How can i say that I want to update the last record ? I heard about the LAST command, but it doesnt work with my MS SQL...
2
1244
by: ahmedlasheen | last post by:
hello every body when iam trying to delete the last record in DGV this erro appears "Input string was not in a correct format." this error appears only when i am trying to delete the last record. . the code i using is the following public void Delete(int id) { ////////////Delete the record from the dataset.///////////...
0
2352
by: marlberg | last post by:
Platform: Windows2000, WindowsXP, Windows Vista, etc Language: C#, ASP.NET Pre-compiled Libraries: Enterprise Library 3.0 full I have a requirement to implement in and display in C# and ASP.NET a DataGrid with Updatable rows based on a date retrieved from a data table in SQL Server. Below is the design algorithm. 1. Retrieve the...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8120
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7672
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7968
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6283
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1212
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.