sql permissions to run only update stats

NeophyteSQL 241 Reputation points
2020-08-24T19:36:09.74+00:00

hi all,

we would like to give some business users with access to run only update stats.
I am thinking of creating a role for these users and somehow assign them the rights to run "update stats"
would you please share can I grant the users permisisons to run the sp_updatestats without them being in the sysasmin role.

thanks a lot for help

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,770 questions
0 comments No comments
{count} votes

Accepted answer
  1. David Browne - msft 3,846 Reputation points
    2020-08-24T20:08:26.617+00:00

    There's no granular permission for just UPDATE STATISTICS. Instead write a stored procedure to update the stats and give them EXECUTE permissions to the procedure.

    eg:

    create or alter procedure update_stats
    with execute as owner
    as
    begin
       update statistics sometable with fullscan
    end
    
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. NeophyteSQL 241 Reputation points
    2020-08-24T20:11:36.537+00:00

    Thank you very much.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.