At 2:55 PM -0800 1/8/00, Kole Dunn wrote:
>Great! thanks, it worked! I wasn't kidding when I said I was really
>new at this, eh? Back to reading the manual more carefully...
>
>KD
>
>
>>The query should be like this, not specifying a NULL for the current
>>field. :-)
>>
>>INSERT INTO timetest (stuff) VALUES ('stuff');
>>
>> >OK, here is the statement and the result:
>> >
>> >
>> >mysql> INSERT INTO timetest VALUES ('stuff','NULL');
>> >Query OK, 1 row affected (0.00 sec)
>> >
Actually, I think you CAN use NULL here to set the timestamp to
current time; however, 'NULL' - a string value - is not equivalent to
NULL. Did you try
INSERT INTO timetest VALUES ('stuff',NULL);
If you don't specify all fields in an INSERT statement, I'm 94.56%
sure that MySQL will insert the column's default value or NULL if
there is no default.
- steve
>> >mysql> select*from timetest;
>> >+-----------+----------------+
>> >| stuff | current |
>> >+-----------+----------------+
>> >| teststuff | 00000000000000 |
>> >| stuff | 00000000000000 |
>> >+-----------+----------------+
>> >2 rows in set (0.00 sec)
>> >
>> >Still just zeros...
>> >
>> >KD
>> >
>> >
>> >>On Sat, Jan 08, 2000 at 02:01:21PM -0800, Kole Dunn wrote:
>> >> > Here is the statment for creating the table:
>> >> > mysql> CREATE TABLE timetest (stuff VARCHAR(20), current
> TIMESTAMP);
>> >> >
>> >> > When I insert data, do I need to also enter something for the
>> >> > timestamp? I was under the impression that it automatically
> displayed
>> >> > a date in that field.
>> >>
>> >>Insert a NULL for the TIMESTAMP field. MySQL will insert the
>> >>proper value.
>> >
+--------------- my people are the people of the dessert, ---------------+
| Steve Edberg University of California, Davis |
| sbedberg@stripped (530)754-9127 |
| Computer Consultant http://aesric.ucdavis.edu/ |
+---------------- said t e lawrence, picking up his fork ----------------+