Newbie Question (column names)

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 ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-02-2006
Lee Peedin
 
Posts: n/a
Default Newbie Question (column names)

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


Reply With Quote
  #2 (permalink)  
Old 09-02-2006
Lee Peedin
 
Posts: n/a
Default Re: Newbie Question (column names)

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
>


Reply With Quote
  #3 (permalink)  
Old 09-02-2006
Brian Wakem
 
Posts: n/a
Default Re: Newbie Question (column names)

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
Reply With Quote
  #4 (permalink)  
Old 09-02-2006
Lee Peedin
 
Posts: n/a
Default Re: Newbie Question (column names)

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

Reply With Quote
  #5 (permalink)  
Old 09-02-2006
Brian Wakem
 
Posts: n/a
Default Re: Newbie Question (column names)

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
Reply With Quote
  #6 (permalink)  
Old 09-05-2006
nelsonsoft@nssdd.com
 
Posts: n/a
Default Re: Newbie Question (column names)

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


Reply With Quote
  #7 (permalink)  
Old 09-05-2006
Lee Peedin
 
Posts: n/a
Default Re: Newbie Question (column names)

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


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 12:53 AM.


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