Results 1 to 6 of 6

Thread: Select Question

  1. #1
    Join Date
    Apr 2009
    Posts
    15

    Unanswered: Select Question

    Hi guys, I have a weird one here.

    I have a column called "Start Date [mm/dd/yy]". Now im not sure how to select it since I know from experience that we use the [] to denote a column with a space. However if i use [Start Date [mm/dd/yy]] SQL balks at me.

    Can you guys help? Never seen this before.

    Thanks.

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Code:
    SELECT [Start Date [mm/dd/yy]]]
    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by Pat Phelan View Post
    Code:
    SELECT [Start Date [mm/dd/yy]]]
    that works? with the extra unmatched trailing ] ??

    whoa
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    It is just like using doubled apostrophes within a quoted string, you double the closing quote. Maybe this will help:
    Code:
    SELECT [Start Date [mm/dd/yy]]]
    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  5. #5
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    thanks, yes, your explanation helped
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  6. #6
    Join Date
    Apr 2009
    Posts
    15
    I would never have thought, thanks a bunch youre the King! As you may already know

    Funny thing is i use the ''' quite a lot in dynamic SQL, so never thought that this would be the case for [].

Posting Permissions

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