Ms Sql:将csv导入msql数据库不起作用

时间:2011-11-02 05:53:48

标签: mysql sql sql-server

我使用以下代码将csv加载到数据库中:---

LOAD DATA LOCAL INFILE'C:\ Documents and Settings \ vishu.singhvi \ Desktop \ 5columns.csv'
INTO TABLE digite61new.copy_ENTERPRISEUSER FIELDS终止于','''''''''''''by by by by by by by by by by by by by by by by by by by by by by by by by by by by by by by by by '\ n'IGNORE 1 LINES;

但它显示错误: - 'C:\ Documents and Settings \ vishu.singhvi \ Desktop \ 5columns.csv'附近的语法不正确

请帮忙。

1 个答案:

答案 0 :(得分:0)

在SQL Server上,不支持此语法。

在MySQL上我不认为它应该给出你看到的错误,但你的文件名是错误的。

LOAD DATA LOCAL INFILE 'C:\\Documents and Settings\\vishu.singhvi\\Desktop\\5columns.csv'

来自documentation

  

反斜杠是SQL语句中字符串中的MySQL转义字符,因此要指定文字反斜杠,必须为要解释为单个反斜杠的值指定两个反斜杠