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

Posted on 2003-02-27
Medium Priority
Last Modified: 2012-06-27

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.

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.


Question by:deschew
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 18

Accepted Solution

nigelrivett earned 150 total points
ID: 8039591
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.

LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 8040589
I agree with nigelrivett (points to him)

Expert Comment

ID: 9276241
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 
Post your closing recommendations!  No comment means you don't care.

Author Comment

ID: 9284230
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.

Featured Post

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

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

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Suggested Courses

801 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