Michal Čihař a écrit :
Hi
On Mon, 12 Jun 2006 09:59:20 +0200 Sebastian Mendel lists@sebastianmendel.de wrote:
in english: is it possible to automatically create a table from CSV file? in other words: auto detect field type by content?
IMHO it could be possible, however there could be several problems:
- what length should be char fields? text or varchar?
This reminds me: in MySQL 5.0.3+, a VARCHAR can be 65532 bytes! So for this feature we probably could use VARCHAR instead of TEXT if the MySQL version is recent enough.
Marc
- detecting field type from whole file can take very long, so you need
to scan only few lines and then somehow handle error when your expectation fails later
We might simply choose to import everything to text fields and then let MySQL create 'optimal' structure by SELECT * FROM `table` PROCEDURE ANALYSE (). But it tends to create ENUMs for small set of values.
Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel