Results 1 to 3 of 3

Thread: 'Index' Problem

  1. #1
    Join Date
    Dec 2011

    Question Unanswered: 'Index' Problem

    So my little problem is as follows..

    I want to Select a value from a Column which is named "Index" - and I don't want to change the name naturally. Is there a way to get a value without mentioning the Column name itself, rather the column number?

    "Incorrect syntax near 'Index'. If this is intended as a part of a table hint, A WITH keyword and parenthesis are now required. See SQL Server Books Online for proper syntax."

    Occurs when I try to simply..
    -> SELECT Index FROM Table WHERE Name like 'xyz' <-

    I already searched for solutions but couldn't find a working one, the WITH thingy is mentioned only for the FROM problem with Index, not the Select itself.

    I'd really appreciate a response and thanks in advance!

  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    SELECT [Index] FROM Table WHERE ...


    SELECT Table.Index FROM Table WHERE ... | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Dec 2011
    Awesome.. I already assumed that it's so easy and I cud swear that I've tried it out to simply put it into [..] but well - many thanks!
    Was obviously too easy to figure it out on my own.

    The Tablename.Index thingy returns also the error but [..] works properly, thanks

Posting Permissions

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