Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Sharing the procedure to another database

Author  Topic 

sainath_mannem
Starting Member

6 Posts

Posted - 2011-09-30 : 09:26:05
Hi,
I am new to SQL Server,
I have two databases A and B in my database server.
My requirement is to give execute permission on
one of the procedure(proc1) in database A to database B user(UserB).
Is it possible in SQL Server?
If it is possible, Can you please give the SQL Script for this...

Sainath Mannem

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-30 : 11:01:56
you can. between is it a windows domain login or sql login?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

sainath_mannem
Starting Member

6 Posts

Posted - 2011-10-03 : 02:30:05
For SQL login, Please give me sample script, it will be helpful for me,
Thanks in advance

Sainath Mannem
Go to Top of Page

sainath_mannem
Starting Member

6 Posts

Posted - 2011-10-03 : 02:30:27
For SQL login, Please give me sample script, it will be helpful for me,
Thanks in advance

Sainath Mannem
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-03 : 02:39:12
use GRANT statement

http://msdn.microsoft.com/en-us/library/ms187965.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

sainath_mannem
Starting Member

6 Posts

Posted - 2011-10-03 : 05:57:27
I am not able to get anything there, there describes how to give permission to same database user, my requirement is to give permission to other database user, Can anyone help me on this?

Sainath Mannem
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-03 : 06:20:15
dont user have mapped login in other database?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

sainath_mannem
Starting Member

6 Posts

Posted - 2011-10-03 : 06:51:53
User have access to both databases, I am connecting to database using JDBC call, In java application user will connected to fixed database, i want to execute other database stored procedure without updating the database connection details.

In database1 procedure is created,
Requirement is user will connected to database2, but he need to access to execute database1 stored procedure by using database2 connection details.
Can you please give the script to give permission to execute stored proc from any database.

Sainath Mannem
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-03 : 07:56:57
if he has access to other db and is not explicitly denied access to stored procedure which is what your response suggests, he can access otherdb stored procedure as

EXEC <dbname>.<schemaname>.procname

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -