This is a discussion on Newbie Question (column names) within the MySQL Database forums, part of the Database Forums category; I am in the process of writting a program, in my language of choice, (ooRexx) to perform the following conversion ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I am in the process of writting a program, in my language of choice,
(ooRexx) to perform the following conversion from BTrieve databases to MySQL tables: 1) Gather BTrieve field names 2) Export data from BTrieve to MySQL compatable .csv files 3) Create the MySQL table based on data gleaned in step 1 4) Import the .csv file from step 2 into the table created in step 3 All is going very well and is blazingly fast, but there's one little issue I've encountered that maybe you experienced MySQL users can assist me in. I've encounted several BTrieve field names that MySQL doesn't "like" as table column names (and I fully understand why). The ones so far are: key group desc I've coded my program to prepend such names with the letter "a" (key becomes akey, etc.) Are there other "key words" that I should account for (maybe a list of MySQL "reserved words")? Thanks Lee |
|
|||
|
Nevermind - I reformed my Google search text and came up with the
following link: <http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html> Which I think answers my question. Thanks Lee On Sat, 02 Sep 2006 12:55:19 GMT, Lee Peedin <lpeedinDONOTSPAME@nc.rr.com> wrote: >I am in the process of writting a program, in my language of choice, >(ooRexx) to perform the following conversion from BTrieve databases to >MySQL tables: > >1) Gather BTrieve field names >2) Export data from BTrieve to MySQL compatable .csv files >3) Create the MySQL table based on data gleaned in step 1 >4) Import the .csv file from step 2 into the table created in step 3 > >All is going very well and is blazingly fast, but there's one little >issue I've encountered that maybe you experienced MySQL users can >assist me in. > >I've encounted several BTrieve field names that MySQL doesn't "like" >as table column names (and I fully understand why). >The ones so far are: >key >group >desc > >I've coded my program to prepend such names with the letter "a" (key >becomes akey, etc.) > >Are there other "key words" that I should account for (maybe a list of >MySQL "reserved words")? > >Thanks >Lee > |
|
|||
|
Lee Peedin wrote:
> I am in the process of writting a program, in my language of choice, > (ooRexx) to perform the following conversion from BTrieve databases to > MySQL tables: > > 1) Gather BTrieve field names > 2) Export data from BTrieve to MySQL compatable .csv files > 3) Create the MySQL table based on data gleaned in step 1 > 4) Import the .csv file from step 2 into the table created in step 3 > > All is going very well and is blazingly fast, but there's one little > issue I've encountered that maybe you experienced MySQL users can > assist me in. > > I've encounted several BTrieve field names that MySQL doesn't "like" > as table column names (and I fully understand why). > The ones so far are: > key > group > desc > > I've coded my program to prepend such names with the letter "a" (key > becomes akey, etc.) > > Are there other "key words" that I should account for (maybe a list of > MySQL "reserved words")? It doesn't matter, just put backticks around the column names and you can call them key, group, desc etc. -- Brian Wakem Email: http://homepage.ntlworld.com/b.wakem/myemail.png |
|
|||
|
On Sat, 02 Sep 2006 19:24:21 +0100, Brian Wakem <no@email.com> wrote:
>Lee Peedin wrote: > > >It doesn't matter, just put backticks around the column names and you can >call them key, group, desc etc. Thanks for the tip Brian, but wouldn't that also mean that the backticks would have to be used in any SQL statement that might involve such names? Lee |
|
|||
|
Lee Peedin wrote:
> On Sat, 02 Sep 2006 19:24:21 +0100, Brian Wakem <no@email.com> wrote: > >>Lee Peedin wrote: >> >> >>It doesn't matter, just put backticks around the column names and you can >>call them key, group, desc etc. > > Thanks for the tip Brian, but wouldn't that also mean that the > backticks would have to be used in any SQL statement that might > involve such names? Yes. If you put backticks around all col names all the time then you don't need to test whether or not you need to use backticks. -- Brian Wakem Email: http://homepage.ntlworld.com/b.wakem/myemail.png |
|
|||
|
If you need to export your Btrieve data to .csv you might take a look
at BtSearch at www.nssdd.com. It will export many data types that ODBC does not recognize. You would export to .csv and then import that into your MySQL. Gil Lee Peedin wrote: > I am in the process of writting a program, in my language of choice, > (ooRexx) to perform the following conversion from BTrieve databases to > MySQL tables: > > 1) Gather BTrieve field names > 2) Export data from BTrieve to MySQL compatable .csv files > 3) Create the MySQL table based on data gleaned in step 1 > 4) Import the .csv file from step 2 into the table created in step 3 > > All is going very well and is blazingly fast, but there's one little > issue I've encountered that maybe you experienced MySQL users can > assist me in. > > I've encounted several BTrieve field names that MySQL doesn't "like" > as table column names (and I fully understand why). > The ones so far are: > key > group > desc > > I've coded my program to prepend such names with the letter "a" (key > becomes akey, etc.) > > Are there other "key words" that I should account for (maybe a list of > MySQL "reserved words")? > > Thanks > Lee |
|
|||
|
Gil,
Thanks for the pointer, but we've been using BTrieve for several years and through the use of ooRexx libraries I've created a BTrieve to .csv scipt that works quite well. Basically it prompts the user for the file to extract and the corresponding ddf name. It then extracts the field definitions in the ddf. From there the ..csv is built, the table is built (with an additional primary key field added), and finally it loads the csv into the newly created table. All field names are compared against a word list of MySQL "reserved words" and the field name for matches is pre-pended with the letter "a". After discussing this with the author of the Rexx/SQL interface, he has suggested/recommended that even though the backticks work, we should continue the practice of not using any column names that conflict with reserved words - in the event that we at some point move to an SQL server that is not as accomodating as MySQL. Lee On 4 Sep 2006 16:27:14 -0700, nelsonsoft@nssdd.com wrote: >If you need to export your Btrieve data to .csv you might take a look >at BtSearch at www.nssdd.com. It will export many data types that ODBC >does not recognize. You would export to .csv and then import that into >your MySQL. > >Gil > >Lee Peedin wrote: >> I am in the process of writting a program, in my language of choice, >> (ooRexx) to perform the following conversion from BTrieve databases to >> MySQL tables: >> >> 1) Gather BTrieve field names >> 2) Export data from BTrieve to MySQL compatable .csv files >> 3) Create the MySQL table based on data gleaned in step 1 >> 4) Import the .csv file from step 2 into the table created in step 3 >> >> All is going very well and is blazingly fast, but there's one little >> issue I've encountered that maybe you experienced MySQL users can >> assist me in. >> >> I've encounted several BTrieve field names that MySQL doesn't "like" >> as table column names (and I fully understand why). >> The ones so far are: >> key >> group >> desc >> >> I've coded my program to prepend such names with the letter "a" (key >> becomes akey, etc.) >> >> Are there other "key words" that I should account for (maybe a list of >> MySQL "reserved words")? >> >> Thanks >> Lee |