[MySQL] opcja default a aktualny czas

0

chodzi mi o taki efekt

create table dzialy(
id int auto_increment,
id_parent int not null default 0,
name varchar(128) not null default 'test',
time int not null default unix_timestamp(),
primary key(id),
unique key name(name)
) type=innodb

tyle ze w 4 to nie chce działać, da się to jakoś zrobić?

0

Jeśli dobrze rozumiem, chodzi o UNIX_TIMESTAMP();?
A próbowałeś CURRENT_TIME();?

0

to nie działa tez :/

0
USE baza;
create table dzialy(
id int auto_increment,
id_parent int not null default 0,
name varchar(128) not null default 'test',
czas timestamp default CURRENT_TIMESTAMP(),
primary key(id),
unique key name(name))

Sprawdzałem u siebie pod mySQL'em 5.0.22 i działa

Pozdrawiam

0

ale oczywiście do manuala się nie chciało zajrzeć :/

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.

mam nadzieję, że więcej tłumaczyć nie trzeba

0

dzieki wielkie tez tak myślałam :(

1 użytkowników online, w tym zalogowanych: 0, gości: 1