On Mon, Feb 10, 2003 at 05:41:28PM -0700, David A. Sinck wrote:
/_
/_
/_\_ SMTP quoth Sundar on 2/10/2003 16:16 as having spake thusly:
/_\_
/_\_ Thanks David,
/_\_
/_\_ When you say
/_\_
/_\_ insert into foo ( [contents of file]);
/_\_
/_\_ Does it mean
/_\_
/_\_ insert into foo ( filename );
/_\_
/_\_ I am just trying to achieve it with a SQL query.
/_
/_Ah. Not quite sure how to do that in one query without resorting to
/_the docs or writing a perl script. I've done it via the later.
/_
/_Both are left as an excercise for the reader. :-)
Excercise almost over ..... look at "LOAD DATA .. INFILE .."
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 TERMINATED BY '\n']
[IGNORE number LINES]
[(col_name,...)]
More info at:
http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#LOAD_DATA