I have a query that I've written that runs fine, but any time I reference an object that is in a temp table that I created Microsoft sql server 2008 will underline that reference and tell me that it can't find the object. The weird thing is that the code works perfectly fine. This is how I created my temp table
SELECT * Into #temp from MY_Table where Date >= '2013-09-17'
Then in my query I have Select m.columnName From #temp m
The query works, but sql server management studio says that it cant find the m.columnName.
Is there any way to fix this? Should I create the temp table differently?
This seems to be a known bug.
To make it recognize it, you can create the temp table first and then insert the data. Here is the example picture from the link above where you can see the way intellisense works and doesn't: