|
Hi All, Is there are way to grant Execute permission to a particular Stored procedure or Function in all database of SQL Server 2008 Instance? The below one use to Grant Execute permission to any procedure.
But when trying the below one I'm getting error
I have the 'sp_StroedProc1' exist in all my database in the sql server 2008 instance. Any help will be highly appreciated.
(comments are locked)
|
|
I suggest you run this to verify the existence of the stored procedure in all databases.
Scan the results for any row (database) with NULL in the second column. EDIT: I don't know why it shows in the Object Explorer if it's not really there (unless you just need to refresh the display), but this should solve your problem: It's showing NULL for the SP but it's present in the all the database under my stored procedure section of sql server 2008. Any suggestions?
Jan 27 '10 at 02:06 PM
Akbar
(comments are locked)
|
|
I'm going to guess that you are getting the error when it runs in the system databases as I am assuming you are not putting the procedure in the system databases. So you could do something like this:
(comments are locked)
|
|
another angle: If you can determine which database is failing, maybe you (the user that is running the grant statement) don't have the permission to GRANT. run
into text and see which database gives you the error I have modified the script and even it's showing the same error. But i have the sp_StroedProc1 in my database underneath the stored procedure section of sql server 2008. Any suggestions? DECLARE @grantExecute varchar(8000) select @grantExecute = 'IF ''?'' NOT IN(''master'', ''model'', ''msdb'', ''tempdb'') BEGIN USE ? GRANT EXECUTE ON [dbo].[sp_StoredProc1] TO web END' EXEC sp_MSforeachdb @grantExecute
Jan 27 '10 at 02:11 PM
Akbar
It's working now and i have used the script given by Tom and thanks for your answers as well.
Jan 27 '10 at 03:12 PM
Akbar
(comments are locked)
|

