You are here: Re: Add default value for date field « PHP SQL « IT news, forums, messages
Re: Add default value for date field

Posted by VAUTHIER Christophe on 05/11/05 19:09

I think it's impossible, you have to insert the date each time you write
into your DB. Cf. MySQL Ref Manual:

"
the DEFAULT clause specifies a default value for a column. With one
exception, the default value must be a constant; it cannot be a function or
an expression. This means, for example, that you cannot set the default for
a date column to be the value of a function such as NOW() or CURRENT_DATE.
The exception is that you can specify CURRENT_TIMESTAMP as the default for a
TIMESTAMP column as of MySQL 4.1.2. See Section 11.3.1.2, "TIMESTAMP
Properties as of MySQL 4.1".

"

++

"Rob" <reply@newsgroup.nl> a ιcrit dans le message de news:
d5t77g$drf$1@reader10.wxs.nl...
> Hello all
>
> I have a field (called active) of type DATE and I want to add a default
> value. The default value must be the current date. Is this possible to do
> this in the table create statement?
>
> CREATE TABLE mytable
> (
> id INTEGER NOT NULL AUTO_INCREMENT,
> active DATE DEFAULT ?????,
> PRIMARY KEY (id),
> )
>
> Thanks in advance
> Roger
>
>
>

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация