Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Guest user problems

Author  Topic 

manikandan
Starting Member

35 Posts

Posted - 2002-10-10 : 02:40:24
I've created a a teable in tempdb using guest account.

create table guest.test(sno int).

I go into query analyser as sa user. i issued a query like

select * from test.

It gives me a creepy "invalid object name" error. Even i've given public access to the particular table.

What is the problem here.

I don't want to issue a query like

"select * from guest.test"

Note :- We have a developed a tool for comparing the database of sybase and SQL Server after migrating from the former. And this tool could be run only by dbo. But as these objects are not available to DBO, it is giving this "invalid object name" error.

cheers
manikandan

Cheers
Manikandan

Lavos
Posting Yak Master

200 Posts

Posted - 2002-10-10 : 04:39:31
Don't try to create a permanent table in TempDB. It doesn't work. The database is reset after reboots, and I forget when else. It'll eventually surface as a bug. (of course, I could be wrong on this, and I'm sure I'll hear about it :)

Since the table wasn't created by DBO, you have to specify the "user" name to access the table. There isn't a way to get around that. You can change the owner of the table by using an administrator account, though I'm too sleepy to help out with the function call :) Look in BOL for the proper stored procedure to call.


----------------------
"O Theos mou! Echo ten labrida en te mou kephale!"
Go to Top of Page

Andraax
Aged Yak Warrior

790 Posts

Posted - 2002-10-10 : 04:58:02
Yeah TempDB will be replaced by a fresh copy of the model database every time the server restarts.

Go to Top of Page

manikandan
Starting Member

35 Posts

Posted - 2002-10-10 : 09:18:54
Hi Guys,

Probably i should not have mentioned the tempdb database. Ok fine. I will rephrase the question this way.

I've Northwind database. I've enabled the guest account using
sp_grantdbaccess guest

Then i created a table in the following way :-

create table northwind.guest.test(sno int)

Then i give the permission for the table to the role 'public' using em.

i come back to query analyser using sa login. Then i issue a query like this.

select * from test.

it gives me an invalid object error. Why should there be an error ? I just don't find the right reason to use the ownername.tablename syntax......

Could anyone helpme out on this.

cheers
manikandan

Cheers
Manikandan
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-10-10 : 09:23:44
Because you're NOT logged is as GUEST when you run the query. If you leave off the owner, it defaults to the current user's name as owner, which in the case of sa would default to dbo. But since the table was not created by dbo, it's NOT a valid object.

This is normal behavior, if you don't want to be forced to use owner names then you need to create everything under dbo. Public permissions will not alleviate the problem if the object was created under the guest account.

Go to Top of Page

manikandan
Starting Member

35 Posts

Posted - 2002-10-11 : 04:21:29
Thanks Boss.

cheers
manikandan

Cheers
Manikandan
Go to Top of Page
   

- Advertisement -