6.4.9 LOAD DATA INFILE Syntax
LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name.txt'
[REPLACE | IGNORE]
INTO TABLE tbl_name
[FIELDS
[TERMINATED BY '\t']
[[OPTIONALLY] ENCLOSED BY '']
[ESCAPED BY '\\' ]
]
[LINES
[STARTING BY '']
[TERMINATED BY '\n']
]
[IGNORE number LINES]
[(col_name,...)]


and farther down in that section, the relevant part to you is mentioned:

Note: If you have generated the text file on a Windows system you may have to
change the
above to: LINES TERMINATED BY '\r\n' as Windows uses two characters as a line
terminator.

KL





Wang Feng wrote:

> Hi, guys.
>
> I'm quite new to this mailing list. Does anyone know how many programmers
> are there using this mailing list?
>
> I sent my question (below) about 6hrs ago, but still haven't receive any
> response. Am I on a wrong list? Could someone suggest a better mailing list
> or forum to discuss MySQL questions?
>
> cheers,
>
> feng
>
> ----- Original Message -----
> From: "Wang Feng" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, September 30, 2003 7:11 PM
> Subject: loading data from a textfile into MySQL database table
>
> > Greetings,
> >
> > I have a datafile called 'salary.txt', and it's a tab delimited file, the
> > structure is like this:
> > employee_name<tab>salary<enter>
> > employee_name<tab>salary<enter>
> > ...
> >
> > I have a table called 'salary', and it has the same structure as the
> > 'salary.txt' --- employee_name & salary as the columns;
> >
> >
> > I use the command LOAD DATA INFILE "salary.txt" INTO TABLE salary;
> >
> > After doing that, I do the 'SELECT * FROM databname' to look at the data I
> > loaded. Although the data are there and can be found out by the SELECT
> > query, the layout seems NOT *tidy* at all comparing with other rows typed
> in
> > by hand directly using the INSERT command.
> >
> > Please advise how to solve this problem. Do you think it's too messy to
> load
> > data from a text file to a table?
> >
> >
> > cheers,
> >
> > feng
> >
> >
> >
> >
> > --
> > MySQL General Mailing List
> > For list archives: http://lists.mysql.com/mysql
> > To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
> >
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to