PDA

View Full Version : Loading text files


adedoys
12-10-2003, 04:28 PM
Hi There

Im currently having problems loading a tab seprated file into mysql database.

It loads the data but with each field only loads half the data
i.e. txt file contains "hello how are you world" (for a field)
SQL table contains "hello how"
Not sure whats causing this as i've opened the same file in excel and it works perfectly (renamed it from .txt to .xls) :(


Can someone please shed some light on this

raf
12-10-2003, 06:11 PM
Welcome here,

what length did you set for the stringcolumns ? might be smaller then the values you try to insert into it.

adedoys
12-10-2003, 06:19 PM
of course, :eek: how silly of me thanks raj...
Do you know if sql supports variable length fields rather than fixed, because i think varchar only supports lenths of up to 255..not sure

raf
12-10-2003, 08:05 PM
mySLQ's varchar and char indeed have a max length of 255. But you can use mediumtext (maxlength = 65535, no fixed length ) or one of the other types with heigher lengths.

So there isn't a real limitation-problem ... But these column-types take up more memory resources then varchars, because a larger memoryspace is reserved when you select the field

everything about mySQL column types
http://www.mysql.com/doc/en/Column_types.html

adedoys
12-11-2003, 10:48 AM
Hi Raj thanks again been a great help :thumbsup:

raf
12-11-2003, 03:32 PM
You're welcome. Glad I could help.:cool: