0

I came up with a set of functions that I would like to be accessed from a variety of places. SQL seemed like the best place for this due to accessibility, but I receive this error when trying to use them with a user with only the db_datawriter and db_datareader permissions: "The EXECUTE permission was denied on the object"... etc etc

enter image description here

I want to pass a date and return other dates. Apparently I can't just

SELECT [dbo].[fn_Acct_Day_One] ('1/3/2015')

Any way I can do this without granting db_owner to the user?

3
  • 2
    GRANT EXECUTE ON ... TO ... Commented Jan 13, 2015 at 20:36
  • 2
    I think functions actually need EXECUTE permissions, but yeah @JohnM is right just grant rights.
    – JNK
    Commented Jan 13, 2015 at 20:37
  • I was hunting for a setting, did not suspect a scripted solution. Many thanks!
    – n8.
    Commented Jan 13, 2015 at 20:44

1 Answer 1

2

You need to grant rights to use the function.

GRANT EXECUTE ON Function to UserOrRole
2
  • I did this: GRANT EXECUTE ON SCHEMA::dbo TO user, works like a charm.
    – n8.
    Commented Jan 13, 2015 at 20:49
  • 4
    That'll work as well, as long as you are OK with them being able to execute every stored procedure and function within the dbo schema.
    – mrdenny
    Commented Jan 13, 2015 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.