July 10, 2023 at 8:13 pm
So we have a block of code that I only want system account to run.. but if a user is db_owner.. they still need access to run the full proc.. is there a way to check to see if the user is in the correct Active Directory group.. then I can set a flag that can be used later in the proc.
July 10, 2023 at 8:40 pm
IS_MEMBER() might work for you: https://learn.microsoft.com/en-us/sql/t-sql/functions/is-member-transact-sql?view=sql-server-ver16
July 10, 2023 at 10:48 pm
I am not sure if your issue is anything like ours but we have stored procedures that need to be ran by a specific system account and also need to be ran differently by user account. We ended up having to create two different jobs that call the same stored procedure with the one of the jobs handling the system level stuff that required that system account. Not the system job is ran periodically while the non-system job is ran on manual call from the API.
There was supposed to be a way to change the account on the fly but the details on that were somewhat vague and much more complex than our simple solution.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply