抱歉,如果这是旧消息,但我是脚本和SQL的新手,但是我已经阅读了很长时间的眼睛,我知道什么时候应该寻求帮助.. 这是我的脚本,每个部分(第一部分和第二部分)工作得很好(这对我来说是一阵光明)在没有另一个的情况下运行..(我可以散列出第一部分和第二部分很好地插入所有数据进入col3但留下col2 null并散列出第2部分并将我的所有部分数据转换为col2但是col3为null且col 1设置为autoinc id,它确实保持滴答作用并且是主键)任何使这些协同工作的技巧。我希望col2中的txt1.txt信息和col3中txt2.txt的信息同时存在于一个脚本的同一行上。
提前再次感谢
oo ma code。
#!/bin/bash
mysql -h myremotsqlserver --local-infile --user=myusername -password=iknowisholdntdothis
<< EOF
use mysqldbname;
#PART 1
load data local infile '/path/to/file/txt1.txt' into table mysqltablename
#the @col1 is the only column in the txt file txt1.txt
(@col1) set 2stcoloftable=@col1
#PART 2
load data local infile '/path/to/file/txt2.txt' into table mysqltablename
#the @col1 is the only column in the txt file txt2.txt
(@col1) set 3ndcoloftable=@col1
;
EOF