locked
Invalid column name although the column exists in SQL 2008 RRS feed

  • Question

  • Hi

    I am using SQL 2008.
    When i open the stored procedure in my database one of the coulmn is underlined in red and when moved the cursor over it says'Invalid column name'.
    Suprizingly the column does exists in the table still i get this!

    Also when i try to write a query the column name doesnt come up aotomatically as it does for other column

    Please help out.
    • Moved by Tom Phillips Tuesday, December 22, 2009 3:16 AM Possibly better answer from TSQL forum (From:SQL Server Database Engine)
    Monday, December 21, 2009 10:37 AM

Answers

  • now its resolved I didnt do any just logged off the server and logged in again can see it resolved!

    Thanks all.

    • Marked as answer by Zongqing Li Monday, December 28, 2009 7:52 AM
    Tuesday, December 22, 2009 7:03 AM

All replies

  • Good morning,
    SQL Server uses the information in catalogs of objects to automatically suggest. Make sure that this column has been changed recently, if so look at it this syscollumns is set correctly.

    MCP | MCTS | MCITP - http://leivio.spaces.live.com
    Monday, December 21, 2009 1:03 PM
  • The view 'sys.syscolumns' does contain an entry of the column.
    Not sure if its correct or not!
    Has it to do with the environment??
    Tuesday, December 22, 2009 2:09 AM
  • Could it be that you are not qualifying the column correctly ?


    Try fully qualifying the column name (e.g. SchemaName.TableName.ColumnName)

    or

    Are you using an Alias in the statement for the table ?

    i.e.

    Select table1.column1
    From table1 as t1

    Won't resolove becuase the table name has been aliased.

    or

    Does the security context that the Sp is being edited under have permissions to access the table ?
    Tuesday, December 22, 2009 2:35 AM
  • The column name has been probably changed. Intellisense doesn't detect schema changes automatically. 
    Ctrl+Shift+R will refresh it and should remove the squiggly line.

    Let us know if helpful.

    Abdallah El-Chal, PMP, ITIL, MCTS
    Tuesday, December 22, 2009 3:58 AM
  • Try to update the IntelliSense cache (on the Edit menu select IntelliSense -> Refresh Local Cache, or just press Ctrl+Shift+R).
    Plamen Ratchev
    Tuesday, December 22, 2009 3:59 AM
  • now its resolved I didnt do any just logged off the server and logged in again can see it resolved!

    Thanks all.

    • Marked as answer by Zongqing Li Monday, December 28, 2009 7:52 AM
    Tuesday, December 22, 2009 7:03 AM
  • Hi,

    I am also facing the same issue I have created the table alias but when I refresh it through CTRL+SHIF+R

    The squiggly line remove for some time of period but again it came

    Kindly suggest.

    Friday, February 8, 2019 8:54 PM
  • I am also facing the same issue I have created the table alias but when I refresh it through CTRL+SHIF+R

    The squiggly line remove for some time of period but again it came

    Kindly suggest.

    My suggestion is that you start a new thread, describing your problem from start to end. Piggy-backing on a thread soon ten years old is not the way to ask a question.

    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

    Friday, February 8, 2019 10:40 PM