I'm putting this back on the list where it belongs; that enables everyone to benefit from the discussion, both now and in the future via the archives.

--

Sorry, you're right, I didn't read your entire question thoroughly. You set the default value for a DATETIME column (or any other type for that matter) in the CREATE TABLE statement. For example:

create table if not exists dates03
(id smallint not null default 99,
my_datetime datetime not null default '2006-03-02 12:34:56',
primary key(id));

Please note that a datetime value can be expressed in several different formats. The different formats are explained here: http://dev.mysql.com/doc/refman/5.0/en/datetime.html.

--
Rhino


----- Original Message ----- From: "rtroiana" <[EMAIL PROTECTED]>
To: "'Rhino'" <[EMAIL PROTECTED]>
Sent: Thursday, March 02, 2006 1:29 PM
Subject: RE: TimeStamp issue


Thanks for the reply. I'm using DATETIME instead of TIMESTAMP now. Although
all I wanted to know was if there's any way I can set default values to
DATETIME column.

++Reema

-----Original Message-----
From: Rhino [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 02, 2006 1:26 PM
To: rtroiana; mysql@lists.mysql.com
Subject: Re: TimeStamp issue

If you need a broader range of dates, you could use DATETIME instead of
TIMESTAMP: DATETIME can handle the range '1000-01-01 00:00:00' through
'9999-12-31 23:59:59'. The only big difference is that DATETIME does not
store the fractional part of the seconds, e.g.
milliseconds/microseconds/nanonseconds. If you have to keep the fractional
part of the seconds, you could store them in a second column defined as some

kind of integer.

--
Rhino

----- Original Message ----- From: "rtroiana" <[EMAIL PROTECTED]>
To: <mysql@lists.mysql.com>
Sent: Thursday, March 02, 2006 10:10 AM
Subject: TimeStamp issue


Hi All,



I have recently noticed in the MySQL 5.0 documentation in section 11.3.1.
The DATETIME, DATE, and TIMESTAMP Types, it's mentioned that



"TIMESTAMP values cannot be earlier than 1970 or later than 2037. This
means
that a date such as '1968-01-01', while legal as a DATETIME or DATE value,
is not valid as a TIMESTAMP value and is converted to 0."



Is that a correct range for TimeStamp? It's not big enough to be used in a
real life application.



I plan to use DATETIME instead of TIMESTAMP. I used to use
"CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP" as default value for my
TimeStamp column. Is there a way to assign default value to a DateTime
column, since I couldn't find that in the documentation?



Thanks,

Reema






----------------------------------------------------------------------------
----


No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.1.1/272 - Release Date: 01/03/2006



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.1.1/272 - Release Date: 01/03/2006





--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.1.1/272 - Release Date: 01/03/2006





--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.1.1/272 - Release Date: 01/03/2006


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to