Why do I get 'object could not be found' or 'invalid object name'? Reply with quote
Steven Guest Programmer
You may have seen one of these errors, even though you think the object does, in fact, exist:
Server: Msg 2812, Level 16, State 62, Line 1
Could not find stored procedure '<objectname>'.
Server: Msg 208, Level 16, State 1, Line 1
Invalid object name '<objectname>'.
This can can happen in SQL Server, and can be due to a number of reasons. For example:
* the user you are connecting as does not have SELECT, UPDATE, INSERT, DELETE, EXEC permissions on the object;
* you aren't logging in / connecting as the user you expect;
* you are referencing the object without an owner name prefix (or with the wrong owner name);
* you are connected to the wrong database;
* you are, in fact, spelling the object's name incorrectly.
To avoid this problem, make sure you have a cohesive strategy for object ownership and access. Name all tables and stored procedures with the dbo prefix, and use the prefix when calling the procedure. (This prevents the parser from search for you.objectname instead of going straight to dbo.objectname.) Reply with quote