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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Brackets around column names?

Brackets around column names?

Scheduled Pinned Locked Moved Database
helpquestion
4 Posts 4 Posters 1 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.
  • Q Offline
    Q Offline
    quinton nel
    wrote on last edited by
    #1

    Hi What does the brackets around column names mean?? SELECT [Data] FROM Table Please help

    M A 2 Replies Last reply
    0
    • Q quinton nel

      Hi What does the brackets around column names mean?? SELECT [Data] FROM Table Please help

      M Offline
      M Offline
      Mike Dimmick
      wrote on last edited by
      #2

      The brackets are used to escape any syntax that might otherwise be confused with a SQL keyword, or to allow spaces to appear in a column name. In some contexts Data is a SQL keyword, but not actually in the column list of a SELECT statement. However, the brackets don't do any harm, so you can leave them in.

      Stability. What an interesting concept. -- Chris Maunder

      1 Reply Last reply
      0
      • Q quinton nel

        Hi What does the brackets around column names mean?? SELECT [Data] FROM Table Please help

        A Offline
        A Offline
        albCode
        wrote on last edited by
        #3

        Signifies that the code elements between the square brackets can optionally appear in the SQL query, but are not required. Note that these brackets are not part of the code and must not appear in the SQL query.

        S 1 Reply Last reply
        0
        • A albCode

          Signifies that the code elements between the square brackets can optionally appear in the SQL query, but are not required. Note that these brackets are not part of the code and must not appear in the SQL query.

          S Offline
          S Offline
          stevehnsn
          wrote on last edited by
          #4

          Actually the brackets can appear in the SQL query. They just signify some text string that is its own entity, such as a table name composed of two words with a white space delimiter. You could also use it in a query like this: SELECT columns FROM table WHERE column LIKE '%[%]%' Which essentially escapes the middle percent sign, treating it like a percent sign instead of a wildcard character. I hope this helps. Steve Hanson Tasen Software
          New Hampshire (NH) Website Design and Software Development

          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