Hi @Avyayah ,
I think you should provide the execute permissions on ‘agent_datetime’ function.
Please login with an admin user that have rights to change execute permissions:
GRANT EXECUTE ON [dbo].[XXXXX] TO [Username]
Grant permission to db_owner role:
Open SSMS>>Security>>Logins>>go to properties of user
Click to User Mapping>>check the database where you are going to give the db_owner role
Below this on Database role membership select db_owner role
Giving everybody execution permission, but this is an extreme solution
GRANT Execute on [dbo].your_object to [public]
Grant sysadmin server role to the user:
Open SSMS>>Security>>Logins>>go to properties of user
On Server Roles section check sysadmin