Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid column name SQL Server bug

Tags:

sql

sql-server

I have a stored procedure that is throwing an 'Invalid column name' error for 'ContentMarginExVat';

SELECT  CategoryTitle, ContentID, ContentTitle, ContentMarginExVat, ContentWeight
FROM    VWProductsCurrent
WHERE   ContentID = @ContentID

I have checked both the VWProductsCurrents and the associated table that gets the data, both of these have the ContentMarginExVat selected, but yet the SQL Server Management Studio 2008 still says that the Column has an invalid name.

Wondered if anyone might be able to offer any advice on this?

like image 647
doubleplusgood Avatar asked Jul 06 '10 10:07

doubleplusgood


1 Answers

I had this problem with a query generated by SSMS when I selected "Select First 1000 Rows". Red squiggles under my column names and under my table name. But the query executed instantly and displayed the correct data.

After some Googling I found this link.

I pressed Ctrl-Shift-R to refresh the cache. Nothing happened immediately, but after about 5-6 seconds the squiggles went away on two tables where I was having this problem.

like image 193
Kent Avatar answered Nov 15 '22 10:11

Kent