Grant select on view...

Sybase ASE 12.5

sample code:

sp_addlogin ahoor, password, dbase1

use dbase1
sp_adduser ahoor

create view vw_test
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?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Sybase Database

From novice to tech pro — start learning today.