Friday, March 23, 2012

Invalid Object Name

Ok I'm trying to connect to my easycgi.com MSSQL database.

I can connect OK.

My ID is in the db_owner group.

I can create and edit tables and data.I can open a table and see the data.I can view the SQL statement behind the open table (select * from Table) and execute it successfully.

But if I open a new query window and type "select * from [table]" (or any other query), no matter which table it is, I get an error:

Msg 208, Level 16, State 1, Line 1
Invalid object name '[table name]'.

I've searched the web and found this error plenty of times, usually associated with security or the schema. But all my objects are under dbo and I'm in db_owner... ?

Can you post the exact query you typed into the query analyzer?

|||

I'll go you one better:


|||

Try:

sp_help 'Messages'

or

SELECT*

FROMINFORMATION_SCHEMA.TABLES

and given what you've said, "SELECT USER" should return "dbo", correct?

|||

sp_help 'Messages' gives me this:

Msg 15009, Level 16, State 1, Procedure sp_help, Line 66
The object 'Messages' does not exist in database 'master' or is invalid for this operation.

SELECT *

FROM INFORMATION_SCHEMA.TABLES gives me:

master dbo spt_fallback_db BASE TABLE
master dbo spt_fallback_dev BASE TABLE
master dbo spt_fallback_usg BASE TABLE
master dbo spt_monitor BASE TABLE
master dbo spt_values BASE TABLE

SELECT user gives me "guest"... ? I'm logged on under my own ID.

|||

Ok I disconnected and reconnected, then went to options and told it to connect to my individual database and that seems to have done it... Never had to do that before but I guess querying interactively requires a direct connection to my DB. Strange.

No comments:

Post a Comment