Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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
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

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

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

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Suggested Courses

581 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