Yeong CN schrieb am Freitag, 3. August 2001, 06:43:11:
> How can I add an excel file with *.xls extension
> directly into MySQL database..is it possible to do or
> I need to convert it into *.csv format or *.txt format
> first?
You can put anything into MySQL provided you choose the right
column type. In this case, you should use one of the text or
blob types.
Make sure you escape the special characters. If you program in
php, you wrap the input with the function addslashes which does
the job for you, and you strip the escapes back on retrieval with
stripslashes.
If you don't want to operate on these files, it is probably not a
good idea to put them into the database. In this case, the
general considerations regarding pictures apply. Here is what
Rasmus says about storing pictures in databases:
When dealing with images, it is of course possible
to insert the image data into the database as
binary blobs. However, the value in doing that is
questionable. Until databases provide you with
cool pattern recognition tools that will let you
search a blob for a picture of a rose, having the
image data itself in the database isn't of much
use. Every operating system comes with a finely
tuned blob database. It is called your file
system. So, just put the full-path filename into
the database and leave the images sitting
somewhere on your disk. You will save yourself
much aggrevation in the long run.
As the data format of Microsoft files is not very good
documented, I wonder what operations you may want to perform on
those. Of course, they do have some ASCII inside you may search
for.
You seem to be willing to sacrifice all Excel specific data,
which will happen if you convert to csv or txt. This looks like
you are only interested in the plain ASCII and structure and
don't want to conserve anything that adds on that. In this case
it will be a good idea to convert xls to any of these formats,
because you will save a lot of space.
--
Herzlich
Werner Stuerenburg
_________________________________________________
ISIS Verlag, Teut 3, D-32683 Barntrup-Alverdissen
Tel 0(049) 5224-997 407 · Fax 0(049) 5224-997 409
http://pferdezeitung.de
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php