Yofi
Yofi

Reputation: 47

Invalid Column Name - All Columns in Table

All of my references to a column existing in table departments are getting binding errors. (they are highlighted) However, all of my saved queries referencing this table, though the column references are highlighted, still execute properly. NEW queries do not.

select 
    i.itemnum, i.itemname 
from 
    inventory i 
join 
    departments d on i.dept_id = d.DEPT_ID 
join 
    categories c on d.SUBTYPE = c.cat_id 

where c.description = 'vapors' 

In the above query, both d.DEPT_ID and d.SUBTYPE are highlighted as invalid column name, though they are both most definitely fields that are available in departments and will still return results.

Even in the following query I still get a highlight on DEPT_ID in the code body

select DEPT_ID from departments 

Queries that reference departments still execute, although they still show the red highlight on all references to departments in the code body

I'm wondering if I might have inadvertently changed a setting on departments, although I truly don't know how I would have done so...

Upvotes: 0

Views: 1543

Answers (2)

Suraj Kumar
Suraj Kumar

Reputation: 5643

If your query is running properly and giving the expected results and only your are worry about column not highlighting then you can close and re open the SSMS and check.

If you create any new tables and do not close the SSMS then some time that new tables and columns do not give refreshed.

Upvotes: 0

nicomp
nicomp

Reputation: 4647

Clear your Intellisense cache. The errors/highlights are phantom. If your code works, ignore the errors or clear the cache.

"CTRL + SHIFT + R"

Upvotes: 2

Related Questions