locked
Invalid Column Name Error RRS feed

  • 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

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.  

    http://sqlblog.com/blogs/aaron_bertrand/archive/2012/01/23/bad-habits-to-kick-using-as-instead-of-for-column-aliases.aspx

    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.


    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!

    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.

    Simply the column gcname2 doesn't exist in your table...copy and paste?...
    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

    Wednesday, August 7, 2013 4:24 PM