Home > Database > Mysql Tutorial > mssql server把数据库所有用户存储过程的EXEC权限赋另一角色

mssql server把数据库所有用户存储过程的EXEC权限赋另一角色

WBOY
Release: 2016-06-07 17:47:15
Original
1317 people have browsed it

mssql server把所有用户存储过程的EXEC权限赋另一角色

$sql="create   procedure   sp_GrantProce(@username   varchar(40))
as
begin
        declare   @user   varchar(20),@name   varchar(40)
        declare   t_cursor   cursor   for
        select   user_name(uid)   as   users,name   from   sysobjects   where   (xtype= 'P '   or   xtype= 'X ')   and   status> 0
       
        open   t_cursor
       
        fetch   next   from   t_cursor   into   @user,@name
       
        while   @@fetch_status=0
        begin
                exec( 'grant   execute   on   + '. + '   to   )
                fetch   next   from   t_cursor   into   @user,@name
        end
       
        close   t_cursor
        deallocate   t_cursor
end
go";
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template