30. marts 2011 - 19:08Der er
8 kommentarer og 1 løsning
Mysql Dato
jeg har lavet en tabel hvor jeg har lave attributten dato date... hvordan gør jeg sådan at når jeg laver kommandoen "insert into" indsætter den automatisk den rigtige dat???
ps. så har jeg også lige et ekstra spørgsmål... kan det lade sig gøre hvis man har to attributter der begge er en int eller decimal, at lægge dem sammen og skrive resultatet i en 3.???
Mød TrackMan og Veo på Computerworld Cloud & AI Festival og hør, hvordan tech ændrer måden, vi træner og udvikler talent – fra skolebold til The Masters.
Hej Arne, default value = now(), er det en nyere feature?
I mysql 5.0 manualen står nemlig:
10.1.4. Data Type Default Values
The DEFAULT value clause in a data type specification indicates 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. See Section 10.3.1.1, "TIMESTAMP Properties".
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.