Reputation: 11
Both of the following gave me the error messages Invalid object
but they are the correct names. Any Idea what the problem may be?
select * from TrainingDB.FileTables.employes
Msg 208, Level 16, State 1, Line 1 Invalid object name 'TrainingDB.FileTables.employes'.
select * from employes
Msg 208, Level 16, State 1, Line 1 Invalid object name 'employes'.
Im useing 2014 dev edition
Update I disconnected, reconnected a started a new query by right clicking on TrainingDB this time rather than the main button for new query witch I had been doing before employes is coming up on the intellisense now and select * from employes now works.
Thank you all of you I probably would have been stuck for hours longer without your help.
Upvotes: 0
Views: 458
Reputation: 4350
The error messages are straight. The engine don't found that table in that local PERIOD.
In doubt if the object exits you can try this snippet:
use TrainingDB
GO
declare
@columnName nvarchar(128) = N'MyColumnName'
,@tableName nvarchar(128) = N'employes'
,@schemaName nvarchar(128) = N'FileTables'
select su.name, so.name--, sc.name
from sys.sysusers su
join sys.sysobjects so on so.uid = su.uid
-- join sys.syscolumns sc on sc.id = so.id
where so.xtype = N'U'
and su.name = @schemaName
and so.name = @tableName
-- and sc.name = @columnName
As you can see this can be used to test if schema, table and if you remove comments even the column exists.
If you still cannot find the object the previous answers already points a few motives: wrong server, wrong database, wrong database version (where the table is missing), collation making object names case sensitive, mispelling, lack of permission, etc.
Upvotes: 1
Reputation: 574
Check your db tables name spelling. and also check in which database you are using. You can check by
DatabaseName.dbo.tablename
you also should use Intellisense in sql server management studio. For avoiding these issue. You could down load it there dbforge-sqlcomplete
Upvotes: 1
Reputation: 172518
It looks like you are executing the query on the wrong server. So you can check the server on which you are executing the query.(Assuming that the database and table name which you mentioned in the question is correct.)
Upvotes: 1