Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grant execute privilege to stored procedure on SQL Azure

I recently added a stored procedure to my SQL Azure database. I added that procedure logged in as username1. However, I need to allow username2 the ability to EXECUTE that stored procedure. From what I can tell, username2 cannot see/execute the stored procedure. However, username1 can.

What command do I need to run to allow username2 to execute my stored procedure? I'm confident that it's GRANT. However, I'm not sure of the syntax. Can someone please give me an example?

like image 879
JavaScript Developer Avatar asked Jun 16 '12 17:06

JavaScript Developer


People also ask

What permissions are required to execute stored procedure?

If you've READ permission on database, you can read data only from Tables, Views, and Functions. But to execute stored procedures, you need to provide permission explicitly to user. There are multiple ways you can provide execute permission to any user.

Can Db_owner execute stored procedure?

Btw, db_owner is a database ROLE in SQL Server , not a permission. Or if you want the user to execute all current and future stored procedures and scalar-valued functions: grant execute on schema::dbo to User for a single schema, or just grant execute to User for the whole database.

How do I grant a stored procedure to run permissions in MySQL?

The syntax for granting EXECUTE privileges on a function/procedure in MySQL is: GRANT EXECUTE ON [ PROCEDURE | FUNCTION ] object TO user; EXECUTE. The ability to execute the function or procedure.


1 Answers

You have the same options as if you where using an SQL Server database. You need to GRANT the user proper privileges. Log in as username1 and execute the following:

GRANT EXECUTE ON Nameofyourprocedure TO username2;

For more help on Azure SQL syntax and limitations refer to the following link: http://msdn.microsoft.com/en-us/library/windowsazure/ee336226

like image 67
hpityu Avatar answered Sep 28 '22 01:09

hpityu