Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. Clever Code
  4. MySQL not liking certain "alias_name"

MySQL not liking certain "alias_name"

Scheduled Pinned Locked Moved Clever Code
databasemysqltestingbeta-testinghelp
8 Posts 3 Posters 30 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    snblackout
    wrote on last edited by
    #1

    Yesterday I was in MySQL Query Browser building a SELECT statement. When I used the alias of "LayoutFile" in my SELECT statement, MySQL returns no resultset. Try it yourself. "SELECT (column) AS LayoutFile FROM (table)" - Replace (column) with of course, the column name, and (table) with, the table name. Now, change "LayoutFile" to whatever else you want (Ex. "LayoutFil", etc.) and it'll return the expected resultset. Ok, just did some testing and "LaoutFile" doesn't work either, strange stuff indeed. I haven't submitted this "Bug" to MySQL as of yet, I'm not sure how serious it is. I figure "LayoutFile" is a reserved word or variable inside MySQL? Anyone else think of something? :-D

    G P 2 Replies Last reply
    0
    • S snblackout

      Yesterday I was in MySQL Query Browser building a SELECT statement. When I used the alias of "LayoutFile" in my SELECT statement, MySQL returns no resultset. Try it yourself. "SELECT (column) AS LayoutFile FROM (table)" - Replace (column) with of course, the column name, and (table) with, the table name. Now, change "LayoutFile" to whatever else you want (Ex. "LayoutFil", etc.) and it'll return the expected resultset. Ok, just did some testing and "LaoutFile" doesn't work either, strange stuff indeed. I haven't submitted this "Bug" to MySQL as of yet, I'm not sure how serious it is. I figure "LayoutFile" is a reserved word or variable inside MySQL? Anyone else think of something? :-D

      G Offline
      G Offline
      Graham Bradshaw
      wrote on last edited by
      #2

      OUTFILE is a keyword in MySQL syntax, so it looks like a parsing bug.

      S 1 Reply Last reply
      0
      • G Graham Bradshaw

        OUTFILE is a keyword in MySQL syntax, so it looks like a parsing bug.

        S Offline
        S Offline
        snblackout
        wrote on last edited by
        #3

        Ah, that makes sense, thanks for clarifying.

        1 Reply Last reply
        0
        • S snblackout

          Yesterday I was in MySQL Query Browser building a SELECT statement. When I used the alias of "LayoutFile" in my SELECT statement, MySQL returns no resultset. Try it yourself. "SELECT (column) AS LayoutFile FROM (table)" - Replace (column) with of course, the column name, and (table) with, the table name. Now, change "LayoutFile" to whatever else you want (Ex. "LayoutFil", etc.) and it'll return the expected resultset. Ok, just did some testing and "LaoutFile" doesn't work either, strange stuff indeed. I haven't submitted this "Bug" to MySQL as of yet, I'm not sure how serious it is. I figure "LayoutFile" is a reserved word or variable inside MySQL? Anyone else think of something? :-D

          P Offline
          P Offline
          programmervb netc
          wrote on last edited by
          #4

          You might try AS `LayoutFile`

          Humble Programmer

          S 1 Reply Last reply
          0
          • P programmervb netc

            You might try AS `LayoutFile`

            Humble Programmer

            S Offline
            S Offline
            snblackout
            wrote on last edited by
            #5

            Surrounding the alias_name with the apostrophe worked dandy, thanks a lot for the tip, I've been thinking of how to use a different name, but "LayoutFile" is the best and I couldn't use it until you posted. Cheers! :-D

            P 1 Reply Last reply
            0
            • S snblackout

              Surrounding the alias_name with the apostrophe worked dandy, thanks a lot for the tip, I've been thinking of how to use a different name, but "LayoutFile" is the best and I couldn't use it until you posted. Cheers! :-D

              P Offline
              P Offline
              programmervb netc
              wrote on last edited by
              #6

              Please make sure that you are using the key above the tab key.... ` not ' I think that if you use ' the key next to the enter key it will make it think that it is a string.

              Humble Programmer

              P S 2 Replies Last reply
              0
              • P programmervb netc

                Please make sure that you are using the key above the tab key.... ` not ' I think that if you use ' the key next to the enter key it will make it think that it is a string.

                Humble Programmer

                P Offline
                P Offline
                programmervb netc
                wrote on last edited by
                #7

                BTW I believe if for any reason you ever start running these queries against a linux server if you do not have the `` marks it will give an error, also on linux servers casing matters.

                Humble Programmer

                1 Reply Last reply
                0
                • P programmervb netc

                  Please make sure that you are using the key above the tab key.... ` not ' I think that if you use ' the key next to the enter key it will make it think that it is a string.

                  Humble Programmer

                  S Offline
                  S Offline
                  snblackout
                  wrote on last edited by
                  #8

                  Will do, but using the apostrophe near the enter key worked fine.. not sure if it'll raise problems down the road? I can use the other instead I guess.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups