Create procedure Pro_Grant
@TableName nvarchar(20)
as
BEGIN
declare @roworder int
declare @name varchar(50)
declare @str varchar(500)
declare @cnt int
select identity(int,1,1) roworder ,name into #tmp from sysobjects where name like @TableName+'%'
select @cnt = count(*) from #tmp
set @roworder = 1
while @roworder < = @cnt
begin
select @name = name from #tmp where roworder = @roworder
set @str = 'grant select on '+@name+ ' to webuser'
exec(@str)
set @roworder = @roworder + 1
end
drop table #tmp
END
@TableName nvarchar(20)
as
BEGIN
declare @roworder int
declare @name varchar(50)
declare @str varchar(500)
declare @cnt int
select identity(int,1,1) roworder ,name into #tmp from sysobjects where name like @TableName+'%'
select @cnt = count(*) from #tmp
set @roworder = 1
while @roworder < = @cnt
begin
select @name = name from #tmp where roworder = @roworder
set @str = 'grant select on '+@name+ ' to webuser'
exec(@str)
set @roworder = @roworder + 1
end
drop table #tmp
END