Create table question

This is a discussion on Create table question within the MySQL Database forums, part of the Database Forums category; This is my first mySQL project and it's a conversion of a system written in Retrieve 4GL. The main ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-14-2006
Dave G
 
Posts: n/a
Default Create table question

This is my first mySQL project and it's a conversion of a system
written in Retrieve 4GL. The main data table has got 197 fields - far
too many to enter manually, so I'm looking for a short cut.

If I can get hold of a CSV file of the old data, where the first row
contains the field names, is there a way of creating the table AND
importing the data at the same time - or even just creating the table
and dealing with the data later?

Unless I'm missing something, it doesn't seem that mySQLImport can do
this, nor does phpMyAdmin as far as I can see. (btw, MS Access can,
annoyingly). And I haven't managed to find the answer by googling.

Any suggestions gratefully received.

Thanks
Dave

Reply With Quote
  #2 (permalink)  
Old 12-14-2006
Geoff Muldoon
 
Posts: n/a
Default Re: Create table question

DaveGriffiths70@gmail.com says...
> This is my first mySQL project and it's a conversion of a system
> written in Retrieve 4GL. The main data table has got 197 fields - far
> too many to enter manually, so I'm looking for a short cut.


If your main table has 197 fields, it is highly likely that you have a
seriously flawed design.

GM
Reply With Quote
  #3 (permalink)  
Old 12-14-2006
Bill Karwin
 
Posts: n/a
Default Re: Create table question

Dave G wrote:
> If I can get hold of a CSV file of the old data, where the first row
> contains the field names, is there a way of creating the table AND
> importing the data at the same time - or even just creating the table
> and dealing with the data later?


I would use a scripting language like Perl or awk to parse the CSV file
and generate a CREATE TABLE statement. Then run the output of that
script using the mysql command-line client.

I agree with Geoff that a table with 197 columns is probably not a good
schema design. But that's not what you asked for help with.

Regards,
Bill K.
Reply With Quote
  #4 (permalink)  
Old 12-14-2006
Dave G
 
Posts: n/a
Default Re: Create table question

I agree about 197 fields - but I'm stuck with it. The Retrieve 4GL
system that this data is coming from is still in use. And at the time
of writing I've never even seen it !!

Looks like a bit of fiddling around to create this table - never mind,
it has only got to be done once.

Dave

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 03:19 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0