How to grant an object permission in one db to a user/role which resides in another db

Hi

In SQL Query Analyzer, I execute:

Use mydatabase
grant execute on getDate to rolegroup

(getDate is a user defined stored procedure, rolegroup is a user defined role)

This is ok.

But,
What would be the syntax like if I want to grant a permission to a user/role whom resides in another database.

Is there something like
grant execute on getDate to anotherdatabase@rolegroup


This is crucial for example if an object resides in master database and I need to grant the object to another database user/role.

THanks.






deschewAsked:
Who is Participating?
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.

nigelrivettCommented:
Role are entities within the database and can only be granted permissions on objects within that database.

Put the role in the two databases, put the same users in each then you should be able to grant access within the database.

In fact from bol for Grant
Creates an entry in the security system that allows a user in the current database to work with data in the current database or execute specific Transact-SQL statements.

0

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
Guy Hengel [angelIII / a3]Billing EngineerCommented:
I agree with nigelrivett (points to him)
0
CleanupPingCommented:
deschew:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
deschewAuthor Commented:
Thank you.

But it seems that by putting same role in another database will violate some security issues.

If I am not mistaken the system stored procedure sp_sdidebug is contained inside 'Master' database. If a users in 'Newdatabase' wish to use this system stored procedure, he needs to be in Master database.

Another way is to grant it to the public.

This is the case of system procedure.
0
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
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.