Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docs:mysql:loading_csv_files [2007/10/14 00:15] billhdocs:mysql:loading_csv_files [2008/08/03 00:25] (current) – external edit 127.0.0.1
Line 39: Line 39:
 "35020", "AL", " 33.405559", " -86.95141", "Bessemer", "Alabama" "35020", "AL", " 33.405559", " -86.95141", "Bessemer", "Alabama"
 </code> </code>
 +
 +===== set =====
 +User variables in the SET clause can be used in several ways. The following example uses the first input column directly for the value of t1.column1, and assigns the second input column to a user variable that is subjected to a division operation before being used for the value of t1.column2:
 +<code>
 +LOAD DATA INFILE 'file.txt'
 +  INTO TABLE t1
 +  (column1, @var1)
 +  SET column2 = @var1/100;
 +</code>
 +
 +===== External Links =====
 +  * http://dev.mysql.com/doc/refman/5.0/en/load-data.html
  
  • docs/mysql/loading_csv_files.1192342536.txt.gz
  • Last modified: 2008/08/03 00:25
  • (external edit)