what is the syntax for specifying the default values for timestamps in
MySQL in the CREATE TABLE command?
I have 2 timestamps, one for when the record was entered, the other
for any subsequent updates.
I know that the first timestamp column will be set automatically on
updates, but how does the other for creation timestamp get set.
My app is not generating the SQL directly so setting the value using
the NOW() command is not an option, as the inserts are coming from
different timezones I cannot let the clients set their own values. 6 3259
On 24 Feb 2004 02:09:47 -0800, My Deja wrote: My app is not generating the SQL directly so setting the value using the NOW() command is not an option, as the inserts are coming from different timezones I cannot let the clients set their own values.
If the SQL string is executed server side, the now() function returns
server date and time.
On 24 Feb 2004 02:09:47 -0800, My Deja wrote: My app is not generating the SQL directly so setting the value using the NOW() command is not an option, as the inserts are coming from different timezones I cannot let the clients set their own values.
If the SQL string is executed server side, the now() function returns
server date and time.
On 24 Feb 2004 02:09:47 -0800, My Deja wrote: My app is not generating the SQL directly so setting the value using the NOW() command is not an option, as the inserts are coming from different timezones I cannot let the clients set their own values.
If the SQL string is executed server side, the now() function returns
server date and time.
The default value isn't dynamic (I don't think, anyway)
I would think you could do this like so...
on an insert, both would tstamps have the same initial value (system
clock)...
on an update, just include
update table set field = value, tstamp1 = tstamp1 where whatever whatever
whatever...
if you always do tstamp1 = tstamp1 in you updates, than tstamp1 will always
be the original value that was there during the insert.
if you don't do it, it'll get a new timestamp (which would match tstamp2,
incidentally).
Good luck.
bobb
"My Deja" <my********@yahoo.co.uk> wrote in message
news:90**************************@posting.google.c om... what is the syntax for specifying the default values for timestamps in MySQL in the CREATE TABLE command?
I have 2 timestamps, one for when the record was entered, the other for any subsequent updates.
I know that the first timestamp column will be set automatically on updates, but how does the other for creation timestamp get set.
My app is not generating the SQL directly so setting the value using the NOW() command is not an option, as the inserts are coming from different timezones I cannot let the clients set their own values.
The default value isn't dynamic (I don't think, anyway)
I would think you could do this like so...
on an insert, both would tstamps have the same initial value (system
clock)...
on an update, just include
update table set field = value, tstamp1 = tstamp1 where whatever whatever
whatever...
if you always do tstamp1 = tstamp1 in you updates, than tstamp1 will always
be the original value that was there during the insert.
if you don't do it, it'll get a new timestamp (which would match tstamp2,
incidentally).
Good luck.
bobb
"My Deja" <my********@yahoo.co.uk> wrote in message
news:90**************************@posting.google.c om... what is the syntax for specifying the default values for timestamps in MySQL in the CREATE TABLE command?
I have 2 timestamps, one for when the record was entered, the other for any subsequent updates.
I know that the first timestamp column will be set automatically on updates, but how does the other for creation timestamp get set.
My app is not generating the SQL directly so setting the value using the NOW() command is not an option, as the inserts are coming from different timezones I cannot let the clients set their own values.
The default value isn't dynamic (I don't think, anyway)
I would think you could do this like so...
on an insert, both would tstamps have the same initial value (system
clock)...
on an update, just include
update table set field = value, tstamp1 = tstamp1 where whatever whatever
whatever...
if you always do tstamp1 = tstamp1 in you updates, than tstamp1 will always
be the original value that was there during the insert.
if you don't do it, it'll get a new timestamp (which would match tstamp2,
incidentally).
Good luck.
bobb
"My Deja" <my********@yahoo.co.uk> wrote in message
news:90**************************@posting.google.c om... what is the syntax for specifying the default values for timestamps in MySQL in the CREATE TABLE command?
I have 2 timestamps, one for when the record was entered, the other for any subsequent updates.
I know that the first timestamp column will be set automatically on updates, but how does the other for creation timestamp get set.
My app is not generating the SQL directly so setting the value using the NOW() command is not an option, as the inserts are coming from different timezones I cannot let the clients set their own values. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: My Deja |
last post by:
what is the syntax for specifying the default values for timestamps in
MySQL in the CREATE TABLE command?
I have 2 timestamps, one for when the record was entered, the other
for any subsequent...
|
by: joewhitehair |
last post by:
Using the XSD.exe tool, I created a number of classes from my XSD file.
When I generate the WSDL for my web service, the schema does not have
the proper Occurance constraints for the attributes. In...
|
by: Viorel |
last post by:
Adding new row with default values.
In order to insert programmatically a new row into a database table, without
direct "INSERT INTO" SQL statement, I use the well-known DataTable.NewRow,...
|
by: Barbara Lindsey |
last post by:
I have a case where I am collecting a "Start Date" and an "End Date".
I would like to default the "End Date" to the "Start Date" value if only
the "Start Date" is entered.
I tried setting this as...
|
by: Emi Lu |
last post by:
Hello all,
I have a question about "date" & "timestamp" types in PostgreSQL. I want
to setup the default value '0000-00-00' and "0000-00-00 00:00:00" for
them. However, it seems that PostgreSQL...
|
by: Frans |
last post by:
Hello All,
I have just upgrade my postgresql to 7.4.5-2, but I have problem with
default value in postgresql 7.4.5-2, everytime I set default value for
varchar or timestamp fields, the result...
|
by: presley2 |
last post by:
Hi,
I want to create an auto creation date and update date in my mysql
table. I am using the "MySQL Cookbook" approach, using the TIMESTAMP
field which basically is:
- create 2 new fields in the...
|
by: syntego |
last post by:
We commonly use triggers to log changes to our main tables to
historical log tables.
In the trigger, we create a concatenated string of the old values by
casting them as follows:
...
|
by: Henry J. |
last post by:
I know this could be a dumb question, I just want to confirm that it
is faster to execute inserts, if a timestamp field is set to have a
default value, like DEFAULT CURRENT TIMESTAMP, and skip that...
|
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...
|
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: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
| |