SQL Server Invalid Column name after adding new column

SqlSql ServerSql Server-2008TsqlSql Server-2005

Sql Problem Overview


I just added an identity column to an existing table with data through the SSMS Designer, the table updates fine and I can run a select query against it successfully, but after the query finishes I noticed that the new column is underlined in red with an error indicating it's an invalid column name.

Why does this occur? I would expect the query to fail if the column was invalid.

Does the SSMS keep some type of internal reference to the old table that must be flushed?

I tried closing the DB connection and reopening it, but still the same error. Not sure what I'm missing here.

SELECT TOP 100 
[PRIMARY_NDX_Col1],
[NEW_Col], --QUERY EXECUTES SUCCESSFULLY, BUT THIS IS UNDERLINED RED AS AN INVALID COLUMN
[Col3]
FROM [dbo].[MyTable]

Sql Solutions


Solution 1 - Sql

you can either

  • Press Ctrl+Shift+R

OR

  • Go to Edit >> IntelliSense >> Refresh Local Cache

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionkingrichard2005View Question on Stackoverflow
Solution 1 - SqlDavid BrabantView Answer on Stackoverflow