Thanks, ravi. Have I missed that in the documentation? If it is not there,
could you guys include it please. I think It's a good one

-sherzodR

On Wed, 27 Jun 2001, Ravi Raman wrote:

> hi.
> 
> assuming all inserts and updates never specify a value for UpdatedDate or
> CreationDate, on the initial insert:
> mysql> insert into table (Info) values ('blahblahblah');
> they will both be set to '20010627125429' or something.
> 
> any subsequent updates:
> mysql> update table set Info='somethingelse' where Info='blahblahblah';
> will leave CreationDate as its original value, and change UpdatedDate to
> whatever the current timestamp is because it is first in the table
> description/create definition.
> 
> hth.
> -ravi.
> 
> 
> -----Original Message-----
> From: Sherzod Ruzmetov [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 27, 2001 2:10 PM
> To: Ravi Raman
> Cc: Pete Harlan; Richard Bates; [EMAIL PROTECTED]
> Subject: RE: Creating Table with a Default Datetime field
> 
> 
> 
> Wait, I didn't get the following:
> 
> 
> > an alternate solution is to have a table like this:
> > Create table(
> >      UpdatedDate    timestamp(14),
> >      CreationDate    timestamp(14),
> >      Info        varchar(100)
> >      );
> > as mysql only automatically updates the _first_ timestamp column in a
> table.
> 
> 
> 
> ???? . Could you tell me more about it? And how does it solve thr problem?
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> >
> > hth.
> >
> > -ravi.
> >
> > -----Original Message-----
> > From: Sherzod Ruzmetov [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, June 27, 2001 1:40 PM
> > To: Pete Harlan
> > Cc: Ravi Raman; Richard Bates; [EMAIL PROTECTED]
> > Subject: Re: Creating Table with a Default Datetime field
> >
> >
> >
> >
> > I, c. Then you just have to INSERT INTO it NOW() manually, that works
> >
> >
> > On Wed, 27 Jun 2001, Pete Harlan wrote:
> >
> > > TIMESTAMP is not the solution to his problem; he wants the date to
> > > default to now() when the record is created, not updated.
> > >
> > > There's currently no way to do this in MySQL; default values must be
> > > constants.
> > >
> > > --Pete
> > >
> > >
> > >
> > > > hi.
> > > >
> > > > check out the TIMESTAMP column type...maybe TIMESTAMP(14) as the
> column
> > > > type?
> > > > you can then format the date accordingly with...uh...DATE_FORMAT() in
> > your
> > > > select statements...
> > > >
> > > > hth.
> > > > -ravi
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: Richard Bates [mailto:[EMAIL PROTECTED]]
> > > > Sent: Tuesday, June 26, 2001 3:00 PM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: Creating Table with a Default Datetime field
> > > >
> > > >
> > > > How do I get a default date time in the create table clause...
> > > >
> > > > I have tried
> > > >
> > > > Create table(
> > > >     CreationDate    DATETIME    DEFAULT NOW(),
> > > >     Info        varchar(100)
> > > >     );
> > > > Create table(
> > > >     CreationDate    DATETIME    DEFAULT "NOW()",
> > > >     Info        varchar(100)
> > > >     );
> > > >
> > > > Create table(
> > > >     CreationDate    DATETIME    DEFAULT SYSDATE(),
> > > >     Info        varchar(100)
> > > >     );
> > > > Create table(
> > > >     CreationDate    DATETIME    DEFAULT "SYSDATE()",
> > > >     Info        varchar(100)
> > > >     );
> > > >
> > > > Create table(
> > > >     CreationDate    DATETIME    DEFAULT CURRENT_DATE(),
> > > >     Info        varchar(100)
> > > >     );
> > > > Create table(
> > > >     CreationDate    DATETIME    DEFAULT "CURRENT_DATE()",
> > > >     Info        varchar(100)
> > > >     );
> > > >
> > > > All without the quote return with invalid syntax.
> > > > With the quote inserts "000-00-00 00:00:00" meaining invalid date.
> > > > ==================================
> > > > === Richard Bates
> > > > === TELEHOUSE America
> > > > ==================================
> > > >
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > Before posting, please check:
> > > >    http://www.mysql.com/manual.php   (the manual)
> > > >    http://lists.mysql.com/           (the list archive)
> > > >
> > > > To request this thread, e-mail <[EMAIL PROTECTED]>
> > > > To unsubscribe, e-mail
> > <[EMAIL PROTECTED]>
> > > > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> > > >
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > Before posting, please check:
> > > >    http://www.mysql.com/manual.php   (the manual)
> > > >    http://lists.mysql.com/           (the list archive)
> > > >
> > > > To request this thread, e-mail <[EMAIL PROTECTED]>
> > > > To unsubscribe, e-mail
> > <[EMAIL PROTECTED]>
> > > > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> > > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > Before posting, please check:
> > >    http://www.mysql.com/manual.php   (the manual)
> > >    http://lists.mysql.com/           (the list archive)
> > >
> > > To request this thread, e-mail <[EMAIL PROTECTED]>
> > > To unsubscribe, e-mail
> > <[EMAIL PROTECTED]>
> > > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> > >
> >
> >
> 
> 


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to