473,324 Members | 2,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Inserts that auto-record a timestamp ??


Folks,

I have several tables which I would like to record when a record has
been inserted or updated (say, for example, using the unix timestamp).

Is there a method whereby on every insert or update, that I can have a
column automatically assigned a date value?

My guess is no - but I thought I'd ask before I re-invent the wheel by
re-editing my code.... All help, via the newsgroup would be greatly
appreciated...

Thanks
Randell D.
Jul 23 '05 #1
3 2099
Add a column called timestamp (or whatever) using data type 'timestamp'.

That's it.

Every time a record is inserted/updated this field will be updated with
the current date/time (from the server).

Regards,

Mike Argy
Custom Office Solutions
and UNIX/Windows Applications

On Sat, 29 Jan 2005 07:30:06 +0000, Randell D. wrote:

Folks,

I have several tables which I would like to record when a record has
been inserted or updated (say, for example, using the unix timestamp).

Is there a method whereby on every insert or update, that I can have a
column automatically assigned a date value?

My guess is no - but I thought I'd ask before I re-invent the wheel by
re-editing my code.... All help, via the newsgroup would be greatly
appreciated...

Thanks
Randell D.


Jul 23 '05 #2
"Mike A" <mi**@nowhere.com> wrote in message
news:pa****************************@nowhere.com...
Add a column called timestamp (or whatever) using data type 'timestamp'.

That's it.

Every time a record is inserted/updated this field will be updated with
the current date/time (from the server).

Regards,

Mike Argy
Custom Office Solutions
and UNIX/Windows Applications

On Sat, 29 Jan 2005 07:30:06 +0000, Randell D. wrote:

Folks,

I have several tables which I would like to record when a record has
been inserted or updated (say, for example, using the unix timestamp).

Is there a method whereby on every insert or update, that I can have a
column automatically assigned a date value?

My guess is no - but I thought I'd ask before I re-invent the wheel by
re-editing my code.... All help, via the newsgroup would be greatly
appreciated...

Thanks
Randell D.


Just to follow up this answer, you do not need to perform any time/date
functions in your code to do this either. Simply leave that field out of
your UPDATE/INSERT statement and MySQL will automatically update the field
on it's own.

Norm
--
FREE Avatar hosting at www.easyavatar.com
Jul 23 '05 #3
Norman Peelman wrote:
"Mike A" <mi**@nowhere.com> wrote in message
news:pa****************************@nowhere.com...
Add a column called timestamp (or whatever) using data type 'timestamp'.

That's it.

Every time a record is inserted/updated this field will be updated with
the current date/time (from the server).

Regards,

Mike Argy
Custom Office Solutions
and UNIX/Windows Applications

On Sat, 29 Jan 2005 07:30:06 +0000, Randell D. wrote:

Folks,

I have several tables which I would like to record when a record has
been inserted or updated (say, for example, using the unix timestamp).

Is there a method whereby on every insert or update, that I can have a
column automatically assigned a date value?

My guess is no - but I thought I'd ask before I re-invent the wheel by
re-editing my code.... All help, via the newsgroup would be greatly
appreciated...

Thanks
Randell D.


Just to follow up this answer, you do not need to perform any time/date
functions in your code to do this either. Simply leave that field out of
your UPDATE/INSERT statement and MySQL will automatically update the field
on it's own.

Norm

Mike / Norm,

Luvely Juvely - Many thanks for that!

Cheers
Randell D.
Jul 23 '05 #4

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

Similar topics

1
by: Glabbeek | last post by:
I'm changing the layout of my site. Instead of using tables, I will use DIVs. It's working fine, except for 1 thing: In IE6 some DIVs are not the correct width. Mozilla and Opera are showing the...
7
by: Steven D.Arnold | last post by:
How good is Postgres' performance for massive simultaneous insertions into the same heavily-indexed table? Are there any studies or benchmarks I can look at for that? I understand Postgres uses...
3
by: deathyam | last post by:
Hi, I have an Excel 97 app in which I'm using SQL INSERTs to insert data into an Access 97 database table. The table structure is as follows: VersionID (PK) (Long) MetricID (PK) (Long)...
20
by: Vijay Kumar R. Zanvar | last post by:
Hello, Unlike register, auto keyword can not be used to declare formal parameter(s). Is there any specific reason for this? Kind regards, Vijay Kumar R. Zanvar
5
by: Samuel | last post by:
Hi, I am running into a problem of mixing UICulture = auto and allowing users to select culture using a dropdown list. I am detecting a querystring, "setlang", and when found, setting the...
3
by: zelnaga | last post by:
according to the mysql manual, multiple inserts can be sped up by locking the table before doing them and unlocking the table afterwards. is the same true of multiple inserts in mysql? if so,...
2
by: simonZ | last post by:
I create a transaction: sqlTran=sqlConn.BeginTransaction(IsolationLevel.Serializable); Then, I insert some data into report table with sqlCommand object: oCmd = new...
0
by: poe | last post by:
Hello, I have a large database table running on SQL Server 8.0. It currently has nearly 98 million records on it's ways to 125 million. I am doing inserts as quickly as the server can handle it,...
18
by: Charles Law | last post by:
I have a sproc that returns data from a table using a simple SELECT. There are quite a few rows returned, e.g. ~150,000. In my first application, I use a reader on the sproc and iterate through...
3
by: Amber | last post by:
We are using 8.2.9 Windows 64 edtion, in one of our projects we need to recreate a few lager tables which have many millions of rows each, we have used concurrent Java threads to read from data...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.