E Arredondo wrote:
Is there a way to create a MYSQL table or database using a text file that
countains the Field name and the lenght ?
I would do the following:
1. Open the text file in an editor
2. Paste "CREATE TABLE myTableName (" at the start
3. Edit each line in the file into VARCHAR field definitions
(e.g. "name VARCHAR(10) NOT NULL DEFAULT '',")
4. Paste ");" at the end.
5. Save, quit, and run the resulting file as a script using the 'mysql'
tool.
When you have a task like this that likely only has to be done once,
finding and learning a fancy specialized tool to automate it is usually
not the best use of time. Just do the edit by hand and you'll be done.
Unless you need to do this on a much larger scale than you described,
i.e. thousands of fields, or be able to repeat the operation many times.
In which case, a script written in Perl is your friend (sed would work
too).
Regards,
Bill K.