Grant execute permission for a user on all stored procedures in database?

前端 未结 5 842
傲寒
傲寒 2020-12-07 14:40

I generated script from old database, created a new database and imported all data from old database. So far so good, however, no user has execute rights for stored procedur

5条回答
  •  醉梦人生
    2020-12-07 15:14

    use below code , change proper database name and user name and then take that output and execute in SSMS. FOR SQL 2005 ABOVE

    USE  
    select 'GRANT EXECUTE ON ['+name+'] TO [userName]  '  
    from sys.objects  
    where type ='P' 
    and is_ms_shipped = 0  
    

提交回复
热议问题