title: Insert CSV data in MySQL field table
body: <p>I have a question about CSV data file and MySQL. I get a MySQL Database with maybe 40 tables and I would like filling a field in my llx_societe table from a CSV file.</p>
  
  <p>My table looks like :</p>
  
  <pre><code>mysql&gt; select * from llx_societe limit 1 ;
  +-------+-----------+------------+--------+---------+---------+--------+--------+---------------------+-------+--------+-------------+------------------+-------------+-------------------------+----------------------+-------+-------------+----------------+---------+-------+------+------+-------+-------+-------------+-----------+--------------------+-------------+-------+-------+------+---------+---------+---------+-----------+---------+-----------+--------------+-------------+-----------+-------------+--------+-------------+------------------+------------------+--------------+--------------------+--------------+---------------+---------------+---------------+---------------+---------------+----------------+----------------+-------------------------+-------------------------+--------------------+-----------+-----------------+-----------------+-----------------+-----------------+---------+-----------------+-------------+-------------------+--------------+------+--------+------------+-----------------+-----------------+------------------+--------------------+
  | rowid | nom       | name_alias | entity | ref_ext | ref_int | statut | parent | tms                 | datec | status | code_client | code_fournisseur | code_compta | code_compta_fournisseur | address              | zip   | town        | fk_departement | fk_pays | phone | fax  | url  | email | skype | fk_effectif | fk_typent | fk_forme_juridique | fk_currency | siren | siret | ape  | idprof4 | idprof5 | idprof6 | tva_intra | capital | fk_stcomm | note_private | note_public | model_pdf | prefix_comm | client | fournisseur | supplier_account | fk_prospectlevel | fk_incoterms | location_incoterms | customer_bad | customer_rate | supplier_rate | fk_user_creat | fk_user_modif | remise_client | mode_reglement | cond_reglement | mode_reglement_supplier | cond_reglement_supplier | fk_shipping_method | tva_assuj | localtax1_assuj | localtax1_value | localtax2_assuj | localtax2_value | barcode | fk_barcode_type | price_level | outstanding_limit | default_lang | logo | canvas | import_key | webservices_url | webservices_key | fk_multicurrency | multicurrency_code |
  +-------+-----------+------------+--------+---------+---------+--------+--------+---------------------+-------+--------+-------------+------------------+-------------+-------------------------+----------------------+-------+-------------+----------------+---------+-------+------+------+-------+-------+-------------+-----------+--------------------+-------------+-------+-------+------+---------+---------+---------+-----------+---------+-----------+--------------+-------------+-----------+-------------+--------+-------------+------------------+------------------+--------------+--------------------+--------------+---------------+---------------+---------------+---------------+---------------+----------------+----------------+-------------------------+-------------------------+--------------------+-----------+-----------------+-----------------+-----------------+-----------------+---------+-----------------+-------------+-------------------+--------------+------+--------+------------+-----------------+-----------------+------------------+--------------------+
  |     1 | A.D.P.N.  | NULL       |      1 | NULL    | NULL    |      0 |   NULL | 2016-06-02 10:11:46 | NULL  |      1 | NULL        | NULL             | NULL        | NULL                    | 5  rue des Narcisses | 67116 | REICHSTETT  |              0 |       1 |       | NULL | NULL | NULL  | NULL  |           0 |         8 |                 38 | NULL        | NULL  | NULL  | NULL | NULL    | NULL    | NULL    | NULL      |    NULL |         0 | NULL         | NULL        | NULL      | NULL        |      1 |           0 | NULL             | NULL             |         NULL | NULL               |            0 |             0 |             0 |          NULL |          NULL |             0 |           NULL |           NULL |                    NULL |                    NULL |               NULL |         0 |               0 |            NULL |               0 |            NULL | NULL    |               0 |        NULL |              NULL | NULL         | NULL | NULL   | NULL       | NULL            | NULL            |             NULL | NULL               |
  +-------+-----------+------------+--------+---------+---------+--------+--------+---------------------+-------+--------+-------------+------------------+-------------+-------------------------+----------------------+-------+-------------+----------------+---------+-------+------+------+-------+-------+-------------+-----------+--------------------+-------------+-------+-------+------+---------+---------+---------+-----------+---------+-----------+--------------+-------------+-----------+-------------+--------+-------------+------------------+------------------+--------------+--------------------+--------------+---------------+---------------+---------------+---------------+---------------+----------------+----------------+-------------------------+-------------------------+--------------------+-----------+-----------------+-----------------+-----------------+-----------------+---------+-----------------+-------------+-------------------+--------------+------+--------+------------+-----------------+-----------------+------------------+--------------------+
  1 row in set (0.00 sec)
  </code></pre>
  
  <p>And I want to fill the code_client field with a CSV file which looks like :</p>
  
  <pre><code>1
  20
  30
  40
  60
  70
  90
  17
  </code></pre>
  
  <p>So each line in my llx_societe table corresponding to a CSV file number.</p>
  
  <pre><code>rowid 1 : code_client = 1
  rowid 2 : code_client = 20
  rowid 3 : code_client = 30
  ...
  </code></pre>
  
  <p>I'm reminding on my paper How I can do that and I'm not sure where I need to specify the field :</p>
  
  <pre><code>mysql&gt; use dolibarr ;
  mysql&gt; LOAD DATA INFILE '~/code_client.csv' 
         REPLACE INTO TABLE 'llx_societe'
         CHARACTER SET 'utf8'
         FIELDS TERMINATED BY '|'
         LINES TERMINATED BY '\r\n'
  </code></pre>
  
  <p>But where I have to specify the code_client MySQL column ?</p>
  
  <p>Thank you for helping me and sorry if my English isn't perfect ^^</p>