易截截图软件、单文件、免安装、纯绿色、仅160KB

MySQL text_fields语句问题.

可能我的问题比较简单 但是毕竟我是一个初学者.所以请各位大大可以说的详细些..

win7下 mysql版本是5.1.40

我遇到如下问题.. 我想将一个book.txt导入数据库..book.txt内容如下

isbn|title|author last|author first|copyright date|
067973452|notes from underground|dostoevsky|Fyodor|august 1944|

因为我建立的authors的表 只有author_id  author_last author_first  country 这四列

使用语句是:
load data infile 'd:/book1.txt' replace into table authors
fields terminated by '|' lines terminated by '\r\n'
text_field (col1, col2, col3, col4, col5)
set author_last = col3, author_first = col4
ignore col1, col2, col5, 1 lines;

本意是忽略authors表中不存在的项. 只导入author_last和author_first 但是出错..请问正确的语句应该是怎样的呢?
建议去mysql版问问

引用
建议去mysql版问问


开始没找到..以转移..谢谢~

参考手册中的例子。 用临时变量,不是 ignore

SQL code:
LOAD DATA INFILE 'file.txt'
INTO TABLE t1
(column1, @dummy, column2, @dummy, column3);


MySQL官方文档 http://dev.mysql.com/doc/refman/5.1/zh/index.html


感谢 acmain_chm的回答..


相关问答:

Mysql 使用问题 - Java / Web 开发

我的Mysql 使用的时候 用dos建立的数据表 在dos中能显示出中文 
但是在 其他的可视页面 和网页中都显示乱码 如何解决?
在mysql控制台:show variables like 'char%';贴结果出来看看。

mysql命令行模式下: ......

怎么在eclipse下向mysql插入变量啊 - Java / Java相关

String SQL="insert into 学生信息表 values(StudentNumber,StudentName,StudentAge)";其中StudentNumber,StudentName,StudentAge都是变量。这样写不对……到底该咋写啊

万分感谢!

String SQL=&q ......

vc++ 用mysql官方 connector 出错 - VC/MFC / 数据库

try
{
sql::Driver *driver;
sql::Connection *con;
//创建连接
driver = get_driver_instance();
con = driver->connect("tcp://192.168.18.52:3306", "root", "1234 ......

如何在C#里实现MYSQL备份功能的主从切换(一主一从)

如题
补充下:
  无程序,给思路也行;


1. 先判断之前的同步是否完成了。 ###如何判断?
2. 进行CHANGE MASTER TO 操作。###我知道可以切换成备份机,但是不知道如何切换回主服务器,
我的邮箱是do ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号