When using a TIMESTAMP column with LOAD DATA INFILE, the TIMESTAMP must be
either set to NULL or an appropriate date within the import file or
specifically left out of the field list in the LOAD DATA INFILE statement as
follows:

  LOAD DATA INFILE  'example.csv' replace into table example FIELDS
TERMINATED BY ',' (id,name);

otherwise TIMESTAMP will be set to the appropriate zero value
('00000000000000').

I hope this helps...

Pat...
[EMAIL PROTECTED]

BTW  I would recommend against using 'timestamp' as a column name since it
is a reserved word.

----- Original Message -----
From: "Clownfish Internet Services - www.clown-fish.com"
<[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, February 04, 2001 11:20 AM
Subject: timestamp(14) fails to change on load data infile


> I am experiencing problems trying to dynamically link tables in Microsoft
> Access 2000 using ODBC and MYSQL.
>
> MYSQL  Ver 11.12 Distrib 3.23.32, for pc-linux-gnu (i686)
> ODBC  myodbc-2.50.36-win95
> MS Access2000 with MDAC 2.1
>
> The error messages I am getting are "this record has been changed by
another
> user since you started editing it"
> I believe it is due to duplicate timestamp(14) values.
>
> For Example:
>
> I have a simple data base created using the following statement:
>
> create table example (id int(11) NOT NULL AUTO_INCREMENT, name
> varchar(10),timestamp timestamp(14),PRIMARY KEY(id));
>
> ***no problem***
>
> mysql> describe example;
> +-----------+---------------+------+-----+---------+----------------+
> | Field     | Type          | Null | Key | Default | Extra          |
> +-----------+---------------+------+-----+---------+----------------+
> | id        | int(11)       |      | PRI | NULL    | auto_increment |
> | name      | varchar(10)   | YES  |     | NULL    |                |
> | timestamp | timestamp(14) | YES  |     | NULL    |                |
> +-----------+---------------+------+-----+---------+----------------+
> 3 rows in set (0.00 sec)
>
> ***problem***
>
> when I import external data in the following format (example.csv)
>
>
> 1,aaaaaaaaaaaaaaaaa
> 2,bbbbbbbbbbbbbbbbb
> 3,ccccccccccccccccc
>
>
> using the following statement:
>
> load data local infile  '/home/fred/example.csv' replace into table
example
> FIELDS TERMINATED BY ',';
>
> mysql> select * from example;
> +----+------------+----------------+
> | id | name       | timestamp      |
> +----+------------+----------------+
> |  1 | aaaaaaaaaa | 00000000000000 |
> |  2 | bbbbbbbbbb | 00000000000000 |
> |  3 | cccccccccc | 00000000000000 |
> +----+------------+----------------+
> 3 rows in set (0.00 sec)
>
> The timestamp has not been changed upon import and hence is duplicated
> throughout.
>
> ***Question***
>
> Is there any way to import from an external source and create a modified
> (unique) timestamp upon import ?
> I have tried defining the timestamp(14) column with "default 'now' ",
> suggested by somone else with a
> similar problem but it doesn't seem to work.
>
> Please Help !
>
> Clownfish
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to