How to resolve LOAD DATA INFILE issue
When I try to use this sql statement:
LOAD DATA INFILE 'url/file.txt'
IGNORE
INTO TABLE myTbl
FIELDS TERMINATED BY '|'
LINES TERMINATED BY '\n'
(SPEC, PERSON, BLAH, BLUH)
I get this error: Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or '开发者_如何学GoUPDATE'. I am trying to insert into an access database. Any clues as to how I can get this LOAD DATA INFILE to work?
the same error also occurs with my BULK INSERT attempts
Load Data infile is a mysql-only sql command, for ms access db you can use vpa to import text file into table
Take a look here : http://support.microsoft.com/kb/113905
(As already mentioned in the comments, that is an MySQL-specific command. So MS Access will not understand it.)
MS Access is a desktop database. So its tools are not as robust as with enterprise databases. It does support dynamic reading of csv files using IN external database
. But I believe that only works with .csv (and possibly tab delimited) files. For other formats you would need to use a schema.ini file.
http://office.microsoft.com/en-us/access-help/select-statement-HP001032265.aspx
INSERT INTO OtherTable ( Columns )
SELECT Columns...
FROM tableexpression [, ...] [IN externaldatabase]
Aside from doing an INSERT the long way (row by row), that is the only option I know of for MS Access.
Those are commands for MySQL. You cannot use them in access.
精彩评论