Server: Msg 208, Level 16, State 1, Line 1

Expert,

I created a table (aa), then I loaded data into this aa table, after data loading, I couldn't select data from QA, it gave error like:
Server: Msg 208, Level 16, State 1, Line 1
I can see my data in EM fpr aa table data return.  I could select data in the same db different tables, but I couldn't select table aa
Thank you for the help.
yrcdba7Asked:
Who is Participating?
 
ralmadaCommented:
Try like this: select * from dbname..aa (two consecutive points)
If not, can you drop the table and create it again?
drop table aa
 
0
 
AanvikCommented:
Can you provide the query you are using?
0
 
yrcdba7Author Commented:
sleect * from aa
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
yrcdba7Author Commented:
select * from dbname.aa

Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'dbname.aa'.
0
 
AanvikCommented:
SELECT * FROM AA

Copy paste this and it should fix it... There was a typo in select..
0
 
AanvikCommented:
select * from dbname.dbo,aa

try this.


0
 
AanvikCommented:
select * from dbname.dbo.aa
0
 
ralmadaCommented:
Or simply
select * from dbname..aa
0
 
ralmadaCommented:
Another possibility is making sure you are on the right db.
use dbname
select * from aa
0
 
yrcdba7Author Commented:
Expert,
This is a very Urgent question, I need to count data then send infor out, I couldn't now.

I tried this it still gave me a error,

select * from dbname.dbo.aa

output error is:

Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'dbname.dbo.AA.

I know it is sample, my typing is 100% correct, but it still give me this error.

0
 
ralmadaCommented:
Have you tried my suggestion?

select * from dbname..aa
0
 
RiteshShahCommented:
there may be a rights issue with the user you are using to get login to your DB or you are not using proper schema.

Please check which schema your table is using with following query.

select t.name,s.name from sys.tables t join sys.schemas s on t.schema_id=s.schema_id

if you table AA don't have DBO schema than use following query

select * from <dbname>.<schemaName>.aa

or

select * from <schemaName>.aa

if this will not work than given permission on AA table to your user which you are using. with following command.

USE AdventureWorks;
GRANT all ON <schemaName>.aa   TO <userName>;


0
 
yrcdba7Author Commented:

Expert,

I ran your select by select t.name,s.name from sys.tables t join sys.schemas s on t.schema_id=s.schema_id
it showed me this error:
Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'sys.tables'.
Which database I should use to run this select. I used master, it had error then I use database name it has the same error.

How can I my database table schema name?
select * from <dbname>.<schemaName>.aa

You know my dbname is KKMM, schemaName? I don't know, its owner is dbo
Thank you for your help.
0
 
ralmadaCommented:
Another way to check the schema is with this query:
SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME
FROM KKMM.INFORMATION_SCHEMA.Tables
WHERE TABLE_NAME = N'aa';
GO
Also it is possiblbe that you are using Case Sensitive collation. So check your spelling.
0
 
ralmadaCommented:
Sorry the query should beL
SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME
FROM KKMM.INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = N'aa';
GO
 
Another way to check the schema is by checking in object explorer. The first part is the schema. See image attached.
And don't forget about the case sensitive collation.

object-explorer.jpg
0
 
ralmadaCommented:
So for instance for table Address, the schema is Person, so when you query it you should do
use AdventureWorks
select * from Person.Address
0
 
yrcdba7Author Commented:

Expert,

I used your this query but nothing queried out. it is empty table.

SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME
FROM KKMM.INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = N'aa';
GO

Then I went to EM to see that table aa, I saw it is dbo.aa
so my table schema is dbo.  I used select to retreive data like

select * from dbo.aa
it still gave me the same error like:

Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'dbo.aa'.

any other idear?  Please!!


 
0
 
RiteshShahCommented:
which id/pass you are using to get connection to sql server? may be the user you are using, don't have rights on your talbe.
0
 
yrcdba7Author Commented:

I checked permission for this database, I have system admin permission.
I can see the table schema is dbo.aa.  so frustrate for this.
0
 
yrcdba7Author Commented:
I also tried to use sa login, then open query analyze, select * from dbname.aa
it showed me the same error.

I used my sql server authentication login with system admin permissioin which I can be sure.  I used this login I can select others tables in the same database.
0
 
yrcdba7Author Commented:

Expert,

yes, I droped table then create it again. it works.

Thank you so so much.

Tina
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.