Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ColumnName = Keyword??

Status
Not open for further replies.

jiggyg

Programmer
Joined
Oct 1, 2007
Messages
61
Location
US
Hello All!

First post here, and I'm hoping someone can help me with this...

I'm working on a db that has a column named 'Function' -- and I want to do a select on that row, but am running into problems because it is a keyword...

How can I properly execute this (Can't change column name...)?:

SELECT Function, count(*)
FROM Space
GROUP BY Function;

When I execute that, I'm getting an error:
Incorrect syntax near the keyword 'Function'.

Thanks in advance for your time and help!!
-jiggyg
 
SELECT [Function], count(*)
FROM Space
GROUP BY [Function];
 
Super!!

Thanks for the clarification!
 
or "Function" depending on your setting for QUOTED_IDENTIFIER

[COLOR=black #e0e0e0]For SQL and technical ideas, visit my blog, Squared Thoughts.

The best part about anything that has cheese is the cheese.[/color]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top