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版问问
开始没找到..以转移..谢谢~
参考手册中的例子。 用临时变量,不是 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 使用的时候 用dos建立的数据表 在dos中能显示出中文
但是在 其他的可视页面 和网页中都显示乱码 如何解决?
在mysql控制台:show variables like 'char%';贴结果出来看看。
mysql命令行模式下: ......
mysql数据库的编码格式是utf8
在c++程序中使用C API直接连接mysql数据库,把中文保存到mysql数据库中,中午变成乱码
使用mysql的load命令导入文本文件,无论文本文件是ANSI还是utf8编码,都是乱码
请问上面两个问 ......
原帖请看
http://topic.csdn.net/u/20100115/09/98c6ac75-d6fe-4b6c-90dc-336a738a0c0f.html?14601
总结下就是
apache php mysql 我全部都用的是gb2312,有什么办法可以不用每次mysql_query('SET character_set_r ......