随笔 - 77, 评论 - 62, 访问 - 320279

导航


  • 访问:320279次
  • 积分:816分
  • 排名:第15名
  • 随笔:77篇
  • 评论:62条

随笔分类

随笔档案

相册

最新评论

阅读排行榜

评论排行榜

好饱 阅读(108) 评论(0)

-- 修改用户表权限

declare @roworder int
declare @name varchar(50)
declare @str varchar(500)
declare @cnt int
select identity(int,1,1) roworder ,name into #tmp1 from sysobjects where xtype = 'U' --and Name like 'Think_%'
select @cnt = count(*) from #tmp1
set @roworder = 1
while @roworder < = @cnt
begin
select @name = name from #tmp1 where roworder = @roworder
--print @name
set @str = 'grant execute on '+@name+ ' to 数据库用户名'
--print @str
exec(@str)
set @roworder = @roworder + 1
end

drop table #tmp1

 

 

-- 修改存储过程权限

declare @roworder int
declare @name varchar(50)
declare @str varchar(500)
declare @cnt int
select identity(int,1,1) roworder ,name into #tmp1 from sysobjects where xtype = 'p'
select @cnt = count(*) from #tmp1
set @roworder = 1
while @roworder < = @cnt
begin
select @name = name from #tmp1 where roworder = @roworder
--print @name
set @str = 'grant execute on '+@name+ ' to 数据库用户名'
--print @str
exec(@str)
set @roworder = @roworder + 1
end

drop table #tmp1


发表评论
切换编辑模式