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
 General SQL Server Forums
 New to SQL Server Programming
 Running User Defined Functions

Author  Topic 

DavidChel
Constraint Violating Yak Guru

474 Posts

Posted - 2008-08-29 : 10:55:53
So, I created a user defined function to use in my queries. Everything runs fine as the admin. However, when I try to use the UDF as a read only user which I use for reporting (only has db_datareader) permissions) it can't run.

I've looked in the user properties under database access and nothing is jumping out at me as well as googling for the answer.

How can I limit the reporting login's abilities while granting it the right to use the UDF I created?

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-08-29 : 11:16:15
GRANT EXECUTE ON OBJECT::yourUDFname
TO yourUser;


_______________________________________________
Causing trouble since 1980
Blog: http://weblogs.sqlteam.com/mladenp
Speed up SSMS development: www.ssmstoolspack.com <- version 1.0 out!
Go to Top of Page

DavidChel
Constraint Violating Yak Guru

474 Posts

Posted - 2008-08-29 : 11:17:39
I think I may have found it. I opened the properties of the UDF and it had separate permissions. I added permissions to that object for the reports login and it worked. Is there any way to include those rights in the create script?
Go to Top of Page

DavidChel
Constraint Violating Yak Guru

474 Posts

Posted - 2008-08-29 : 11:22:46
So, this works.

GRANT EXECUTE ON GETSHIPPEDNOTINVOICEDQTY
TO reports


Thanks spirit.
Go to Top of Page
   

- Advertisement -