![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 177 Pomógł: 0 Dołączył: 6.06.2004 Ostrzeżenie: (20%) ![]() ![]() |
być może było o tym na forum, ale ja nie mogę znaleźć. Czy da się tak zrobić w MySQL, żeby w polu date wpisywana była zawsze przy insercie bieżąca data z automatu, bez użycia php? W SQL server działa tak funkcja get_date() chyba??
-------------------- |
|
|
![]() |
![]()
Post
#2
|
|
![]() Grupa: Zarejestrowani Postów: 2 064 Pomógł: 1 Dołączył: 22.01.2003 Skąd: Poznań Ostrzeżenie: (0%) ![]() ![]() |
A co do pytania autora, odpowiedź manuala:
Cytat("http://dev.mysql.com/doc/refman/4.1/en/create-table.html") 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. Po polskiemu: wartość domyślna musi być stała, nie możesz wstawić tam funkcji, więc jedyne rozwiązanie to takie jak powyżej. Ten post edytował spenalzo 7.02.2006, 22:00:57 -------------------- |
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 14.08.2025 - 21:28 |