Reputation: 8695
Up until today I've been able to run queries without using the [databaseName].[dbo].[fieldName]
syntax. And all of a sudden, if I use select * from myTable
I get an error for an invalid object
. I can't possibly think of something that happened between shutting down my PC yesterday and today. Anyone know anything about this?
Msg 208, Level, 16, State 1 Line 1
Invalid object name 'mytable'
It's only been since today that I have to include the database name in the query. There are no other connections open and no other users of this instance of SQL Server.
Upvotes: 0
Views: 15438
Reputation: 107237
I think you mean a query of the form select [fieldName] from [databaseName].[dbo].[mytable]
Here are some possible things to look out for:
use [databasename]
, or select the correct database from the Available Databases
drop down in SSMS)[dbo]
, it can be changed.Edit : More ideas:
SELECT DB_NAME()
to see what the current database name is.Select * from sysobjects where name = 'myobject'
OR
Select * from sys.tables where name = 'mytable'
OR
Select * from INFORMATION_SCHEMA.TABLES
Upvotes: 5