all groups > sql server programming > june 2004 >
You're in the

sql server programming

group:

Can't query attached database


Re: Can't query attached database Partha Mandayam
6/16/2004 1:58:04 PM
sql server programming:
check the owner of the table in EM? Is it dbo? If not you may have to
use <owner>.<tablename>

Regards

Partha Mandayam
Software Consultant
Home page: http://partha.tripod.com


*** Sent via Devdex http://www.devdex.com ***
Can't query attached database Christian Miller
6/16/2004 7:55:10 PM
Hello.
I received a detached database/log from my client. I attached the
database to my SQLServer 2000 SP3 installation just fine. In the
enterprise manager I can query any table I want.

However, when I attempt to query a table via the query analyzer, it
always fails, even though I am logged in as the "sa".
Below is my query and the result. I am not having this trouble with any
other database on the system.

select * from employee

Below is the error message:
Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'employee'.

Any help would be appreciated.

Thanks,
Christian
pariahware@pariahware.com
Pariahware, Inc. Custom Software and Shareware
http://www.pariahware.com
--
God loved you so much that He gave His only son Jesus.
Re: Can't query attached database Christian Miller
6/16/2004 8:19:44 PM
In article <uwTZNx9UEHA.1048@TK2MSFTNGP09.phx.gbl>,
"Tibor Karaszi" <tibor_please.no.email_karaszi@hotmail.nomail.com>
[quoted text, click to view]
Yes, I can view it in the enterprise manager.

[quoted text, click to view]
Yes, I've even used the "use" command to make sure, on occassion.

[quoted text, click to view]
The owner of the table is "dbo".

When I look under the db's users, "dbo" is a name entry, "sa" is the
Re: Can't query attached database (solution?) Christian Miller
6/16/2004 8:27:16 PM
In article
<pariahware-21E05C.16194316062004@news2-ge0.southeast.rr.com>,
[quoted text, click to view]

OK, apparently there is not a database table called "employee", but
there is one called "EMPLOYEE". I don't ever remember table name case
being an issue when performing a querying before. I normally uppercase
key words and lowercase table names. Is this a setting in my SQL Server
that I accidentally set?


Thanks,
Christian
pariahware@pariahware.com
Pariahware, Inc. Custom Software and Shareware
http://www.pariahware.com
--
God loved you so much that He gave His only son Jesus.
Re: Can't query attached database Christian Miller
6/16/2004 8:42:12 PM
In article <v8b1d09b8efaran3m2kt931tf89kd7db6g@4ax.com>,
[quoted text, click to view]

That indeed was the problem. What a waste of my day this has been!
Thanks for the help! :D


Thanks,
Christian
pariahware@pariahware.com
Pariahware, Inc. Custom Software and Shareware
http://www.pariahware.com
--
God loved you so much that He gave His only son Jesus.
Re: Can't query attached database Tibor Karaszi
6/16/2004 9:58:32 PM
Is there really a table called employee? Are you in the right database? Who is the owner of that table?

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/


[quoted text, click to view]

Re: Can't query attached database Hugo Kornelis
6/16/2004 10:28:33 PM
[quoted text, click to view]

Hi Christian,

Have you checked for upper- and lowercase letters? If the database uses a
case-sensitive collation, the tables employee, Employee, EMPLOYEE and
EmplOyEE are all different.

Best, Hugo
--

Re: Can't query attached database Tibor Karaszi
6/16/2004 10:30:04 PM
Try:

SELECT * FROM dbname.dbo.employee. Also, the server might be case-sensitive, make sure you use proper case.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/


[quoted text, click to view]

Re: Can't query attached database (solution?) Tibor Karaszi
6/16/2004 10:48:45 PM
Case sensitivity for object names is based on the database collation (if my memory serves me).

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/


[quoted text, click to view]

Re: Can't query attached database (solution?) Christian Miller
6/17/2004 1:43:13 AM
In article <u2N$QN#UEHA.2920@TK2MSFTNGP10.phx.gbl>,
"Tibor Karaszi" <tibor_please.no.email_karaszi@hotmail.nomail.com>
[quoted text, click to view]


If that per database file or per server? How would I turn off database
collation if I wanted to? I really appreciate all the help on this.



Thanks,
Christian
pariahware@pariahware.com
Pariahware, Inc. Custom Software and Shareware
http://www.pariahware.com
--
God loved you so much that He gave His only son Jesus.
Re: Can't query attached database (solution?) Partha Mandayam
6/17/2004 6:20:22 AM
It is a database setting.

use alter database collate SQL_Latin1_General_CP1_CI_AI

to make it case insensitive.

The collation settings are usually set at the time of setup.

Regards

Partha Mandayam
Software Consultant
Home page: http://partha.tripod.com


*** Sent via Devdex http://www.devdex.com ***
Re: Can't query attached database Richard Ding
6/17/2004 1:30:52 PM
Try sp_helpsort to determine the the sort order.



[quoted text, click to view]

AddThis Social Bookmark Button