HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

invalid object on a table that exists

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
objectthatexistsinvalidtable

Problem

I am getting an "invalid object" warning error in the Management Studio query. Any query against the table works and it links correctly to another table. I am investigating an error that I'm getting in C#. See: https://stackoverflow.com/questions/14409788/is-not-a-foreign-key-column-and-cannot-be-used-here
This is the latest attempt to ferret out what may be going wrong. My linq queries against this table fail, but when I go to classic ADO.NET using SQL strings they work perfectly. Is it possible that this "invalid object" is causing C#/linq to kill the connection?

How do I get the table to stop the "invalid object" error. There are two tables, the following is the simplest one:

USE [Report]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[tblHoliDate](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [Holiday] [date] NOT NULL,
    [Description] [varchar](50) NOT NULL,
    [DOW] [int] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO


It is nothing more than a table of holidays used to calculate the business days between two dates.

edit

Any reference to the table will do (which is why I didn't add a query).

SELECT * FROM tblHoliDate


Mouse over the table name to see the error.

The exact error is "invalid object name tblHolidate". This only occurs on mouse-over and the results of any SQL query against the table are complete and correct.

Solution

The warning on mouse over should be from the auto complete feature, it's my guess. I've met that a few times. Especially with newly created tables in a session.
Try refreshing the cache for Intellisense in Management Studio and this should fix it.

Context

StackExchange Database Administrators Q#33502, answer score: 3

Revisions (0)

No revisions yet.