?
Solved

Grant select on view...

Posted on 2008-11-04
3
Medium Priority
?
2,722 Views
Last Modified: 2013-11-05
Sybase ASE 12.5

sample code:

sp_addlogin ahoor, password, dbase1

use dbase1
sp_adduser ahoor

create view vw_test
as
select * from dbase2..table1

grant select on vw_test to ahoor

-> login as ahoor
-> select * from vw_test
-> error: user ahoor is not a valid user in database dbase2.

I think this is strange. You create a view in a different database but to use it you still have to copy the users from database 1 to database 2? What is the purpose of creating a view if you still have to do that?
Or is there a way to use aliasses or whatever to get around this?
0
Comment
Question by:ahoor
1 Comment
 
LVL 19

Accepted Solution

by:
grant300 earned 600 total points
ID: 22875642
The view is really just a stored query.  If you run the Select statement in the view definition, you have to have privs on the underlying tables; regardless of what database they are in.  If that were not the case, a DBO from on one database could completely circumvent the access controls of any other database.

Another way to do this is to create the views in the database with the target tables as dbo, then the dbo only has to grant privs on the views.  I believe the view inherits the privs of the creator.

Regards,
Bill
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
Social messanging services like WhatsApp and Facebook can help businesses in ways that many owners don't even imagine, giving new opportunities to connect with customers. Discover some of the most innovative things they can do for your company.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question