Answered by:
Invalid Column Name Error

Question
-
I have a query like
select name=firstname from contact
This query is not working in SQL Server 2012, It was working fine in SQL Server 2000.
Is there any configuration changes that needs to be done to suppress this error.
Thanks
Wednesday, August 7, 2013 2:48 PM
Answers
-
What error are you getting? Using SQL Server 2012, I'm able to use aliasing in this fashion. Also, Aaron Bertrand has a great blog article about SQL Aliasing and all of the ways you can accomplish this same task.
Thanks,
Sam Lester (MSFT)
http://blogs.msdn.com/b/samlester
This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click "Mark as Answer" and "Vote as Helpful" on posts that help you. This can be beneficial to other community members reading the thread.- Proposed as answer by Satheesh Variath Wednesday, August 7, 2013 2:55 PM
- Edited by Samuel Lester - MSFTMicrosoft employee Wednesday, August 7, 2013 2:56 PM
- Marked as answer by Allen Li - MSFT Thursday, August 15, 2013 9:03 AM
Wednesday, August 7, 2013 2:53 PM -
I suggest to change it as
select firstName AS Name from dbo.Contact
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles- Marked as answer by Allen Li - MSFT Thursday, August 15, 2013 9:03 AM
Wednesday, August 7, 2013 4:24 PM
All replies
-
I dont think there is any changes related to this type of query.
Can you please post the complete query of yours and also the exact error (including the error numbers you are getting).
Nothing is Permanent... even Knowledge.... My Blog
- Proposed as answer by Satheesh Variath Wednesday, August 7, 2013 2:55 PM
- Unproposed as answer by Naomi N Wednesday, August 7, 2013 4:23 PM
Wednesday, August 7, 2013 2:52 PM -
What error are you getting? Using SQL Server 2012, I'm able to use aliasing in this fashion. Also, Aaron Bertrand has a great blog article about SQL Aliasing and all of the ways you can accomplish this same task.
Thanks,
Sam Lester (MSFT)
http://blogs.msdn.com/b/samlester
This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click "Mark as Answer" and "Vote as Helpful" on posts that help you. This can be beneficial to other community members reading the thread.- Proposed as answer by Satheesh Variath Wednesday, August 7, 2013 2:55 PM
- Edited by Samuel Lester - MSFTMicrosoft employee Wednesday, August 7, 2013 2:56 PM
- Marked as answer by Allen Li - MSFT Thursday, August 15, 2013 9:03 AM
Wednesday, August 7, 2013 2:53 PM -
did you check the collation of both installations? Perhaps your SQL2000 was case insensitive where your SQL2012 is case sensitive. The error indicates the column could not be found, so I presume there is no issue with coding like this
Geert Vanhove DCOD ------ http://geertvanhove.wordpress.com/ ----------- Please click the Mark as Answer or Vote As Helpful if a post solves your problem or is helpful!
- Proposed as answer by Geert Vanhove DCOD Wednesday, August 7, 2013 3:01 PM
Wednesday, August 7, 2013 3:00 PM -
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'gcName2'.
This is the error i am getting.
Wednesday, August 7, 2013 3:06 PM -
give us the exact query that you are trying to execute, I cannot find gcName2 over here.
Nothing is Permanent... even Knowledge.... My Blog
Wednesday, August 7, 2013 3:21 PM -
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'gcName2'.
This is the error i am getting.
Wednesday, August 7, 2013 4:18 PM -
I suggest to change it as
select firstName AS Name from dbo.Contact
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles- Marked as answer by Allen Li - MSFT Thursday, August 15, 2013 9:03 AM
Wednesday, August 7, 2013 4:24 PM