PDA

View Full Version : domanda su mysql


Genocide85
07-01-2007, 16:37
ciao a tutti,sto in fase embrionale nella programmazione in mysql ma ho già un problema che nn riesco proprio a risolve...
devo caricare il contenuto di un file txt in una tabella, e uso la seguente stringa:

load data infile c:/nomefile.txt into table XX;

ebbene questa c***o di stringa nn viene presa :doh: ,sono 2 giorni che cerco sul web ma c'è un errore di sintassi che mi blocca....
chi mi sa aiutare??? :cry:

andbin
07-01-2007, 17:03
ciao a tutti,sto in fase embrionale nella programmazione in mysql ma ho già un problema che nn riesco proprio a risolve...
devo caricare il contenuto di un file txt in una tabella, e uso la seguente stringa:

load data infile c:/nomefile.txt into table XX;

ebbene questa cr*sto di stringa nn viene presa :doh: ,sono 2 giorni che cerco sul web ma c'è un errore di sintassi che sono sicuro essere stupidissimo che mi blocca....
chi mi sa aiutare??? :cry:Innanzitutto la questione principale è dove mettere il file di input.
Dalla documentazione del MySQL:
If LOCAL is specified, the file is read by the client program on the client host and sent to the server. The file can be given as a full pathname to specify its exact location. If given as a relative pathname, the name is interpreted relative to the directory in which the client program was started.If LOCAL is not specified, the file must be located on the server host and is read directly by the server. The server uses the following rules to locate the file:
- If the filename is an absolute pathname, the server uses it as given.
- If the filename is a relative pathname with one or more leading components, the server searches for the file relative to the server's data directory.
- If a filename with no leading components is given, the server looks for the file in the database directory of the default database.

Genocide85
07-01-2007, 19:45
beh se per file di input intendi il .txt allora come vedi dalla stringa che ho scritto è specificato l'indirizzo preciso del file, quindi dovrebbe leggerlo direttamente...
ma invece mi restituisce errore 1064, che nn sono riuscito ad interpretare dall'help del programma stesso.. :(

Genocide85
08-01-2007, 14:23
problema risolto,si trattava di mettere i maledetti apici all'inizio e alla fine dell'indirizzo....il risultato è
load data infile "c:/xxx" into table A;
ciauz!