[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.sqlserver.programming

Invalid Object Name Error

Simon Harris

3/19/2007 6:50:00 PM

Hi All,

I have recently restored a database from my live server to my development
server. On the development server, I have to qualify the database name for
queries to work. e.g.

Query: Select * from customer
Result: Invalid object name 'customer'.

Query: Select * from databasename.customer
Result: Expected number of rows returned

I am running SQL Server 2000 with SP4. I read some where that this is
related to the owner not being SA, this is not the case.

Any help will be much appreciated.

Regards,
Simon.

--
--
* Please reply to group for the benefit of all
* Found the answer to your own question? Post it!
* Get a useful reply to one of your posts?...post an answer to another one
* Search first, post later : http://www.google.co...
* Want my email address? Ask me in a post...Cos2MuchSpamMakesUFat!

--------------------------------------------------------------------------------
I am using the free version of SPAMfighter for private users.
It has removed 5607 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!


4 Answers

Simon Harris

3/19/2007 7:09:00 PM

0

Slight correction...

> I have recently restored a database from my live server to my development
> server. On the development server, I have to qualify the database name for
> queries to work. e.g.

Its actually the username I have to use. e.g. select * from Username.table
works.

--------------------------------------------------------------------------------
I am using the free version of SPAMfighter for private users.
It has removed 5607 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!


Alejandro Mesa

3/19/2007 7:38:00 PM

0

Simon Harris,

It is a good practice to qualify the table using the owner (SQL Server
2000). Check the view INFORMATION_SCHEMA.TABLES and you will see that there
is not such table owned by the user account you are using to access the
database. Also, there is not a table with that name, owned by "dbo", in such
case SQL Server gives you the error you posted. If there is a table with that
name, owned by "dbo" or if you qualify the table with the owner name and you
do not have permision to "select" from it, then the error will be diferent
(SELECT permission denied on object ...).

select c1, c2, c3
from dbo.t1
go


AMB


"Simon Harris" wrote:

> Hi All,
>
> I have recently restored a database from my live server to my development
> server. On the development server, I have to qualify the database name for
> queries to work. e.g.
>
> Query: Select * from customer
> Result: Invalid object name 'customer'.
>
> Query: Select * from databasename.customer
> Result: Expected number of rows returned
>
> I am running SQL Server 2000 with SP4. I read some where that this is
> related to the owner not being SA, this is not the case.
>
> Any help will be much appreciated.
>
> Regards,
> Simon.
>
> --
> --
> * Please reply to group for the benefit of all
> * Found the answer to your own question? Post it!
> * Get a useful reply to one of your posts?...post an answer to another one
> * Search first, post later : http://www.google.co...
> * Want my email address? Ask me in a post...Cos2MuchSpamMakesUFat!
>
> --------------------------------------------------------------------------------
> I am using the free version of SPAMfighter for private users.
> It has removed 5607 spam emails to date.
> Paying users do not have this message in their emails.
> Try SPAMfighter for free now!
>
>
>

Tibor Karaszi

3/19/2007 7:42:00 PM

0

Either have dbo as owner of the objects, or login as the user who created the objects, or make sure
you do user-qualifies the object names in your queries.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/d...
http://sqlblog.com/blogs/tib...


"Simon Harris" <too-much-spam@makes-you-fat.com> wrote in message
news:eBIcJolaHHA.3272@TK2MSFTNGP03.phx.gbl...
> Slight correction...
>
>> I have recently restored a database from my live server to my development server. On the
>> development server, I have to qualify the database name for queries to work. e.g.
>
> Its actually the username I have to use. e.g. select * from Username.table works.
>
> --------------------------------------------------------------------------------
> I am using the free version of SPAMfighter for private users.
> It has removed 5607 spam emails to date.
> Paying users do not have this message in their emails.
> Try SPAMfighter for free now!
>
>

Simon Harris

3/19/2007 7:59:00 PM

0

Guys, thankyou.

--------------------------------------------------------------------------------
I am using the free version of SPAMfighter for private users.
It has removed 5607 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!