Professional Web Applications Themes

Newbie Question (column names) - MySQL

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

  1. #1

    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


    Lee Peedin Guest

  2. #2

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

  3. #3

    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: [url]http://homepage.ntlworld.com/b.wakem/myemail.png[/url]
    Brian Wakem Guest

  4. #4

    Default Re: Newbie Question (column names)

    On Sat, 02 Sep 2006 19:24:21 +0100, Brian Wakem <noemail.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 Guest

  5. #5

    Default Re: Newbie Question (column names)

    Lee Peedin wrote:
    > On Sat, 02 Sep 2006 19:24:21 +0100, Brian Wakem <noemail.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: [url]http://homepage.ntlworld.com/b.wakem/myemail.png[/url]
    Brian Wakem Guest

  6. #6

    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: 

    nelsonsoft@nssdd.com Guest

  7. #7

    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, com wrote:
     [/ref]

    Lee Guest

Similar Threads

  1. Getting column data without column names
    By Jared@Itron in forum Coldfusion Database Access
    Replies: 4
    Last Post: January 18th, 09:26 PM
  2. counting column and getting column names
    By dduck1934 in forum Coldfusion Database Access
    Replies: 0
    Last Post: May 24th, 02:05 PM
  3. Newbie Datagrid Column Scrolling Question
    By Bishop in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: May 13th, 05:05 PM
  4. How to get column names using SQL?
    By Gert van der Kooij in forum IBM DB2
    Replies: 7
    Last Post: July 11th, 04:36 PM
  5. No column names
    By Vesna Martinovic in forum IBM DB2
    Replies: 0
    Last Post: July 3rd, 07:45 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139