If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Microsoft SQL Server > 'Index' Problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-17-11, 16:24
Caipi Caipi is offline
Registered User
 
Join Date: Dec 2011
Posts: 2
Question '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!
Reply With Quote
  #2 (permalink)  
Old 12-17-11, 17:02
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
SELECT [Index] FROM Table WHERE ...

or

SELECT Table.Index FROM Table WHERE ...
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 12-18-11, 04:55
Caipi Caipi is offline
Registered User
 
Join Date: Dec 2011
Posts: 2
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On