Hi there
I'm still finding my way in SQL server so the problem might be very simple (hopefully...).
Would anybody have any idea why:
grant select on table1 to ReadGroup
works fine, and
grant create table to ReadGroup
works fine, yet
grant select to ReadGroup
results in
Server: Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'to'.?
Any help would be immeasurably appreciated
Cheers!Hi
I think you need to specify what table they are being granted select ON...
ie.
GRANT SELECT
ON table
TO user
GO
add them to db_datareader role if you want database wide select ...
des|||if u are looking for granting select permissions to all the user tables
then :
declare @.table varchar(100)
select [name] into #temp from sysobjects where xtype='u'
while exists (select * from #temp)
begin
select top 1 @.table=[name] from #temp
exec ('Grant select on '+@.table+' to ReadGroup')
delete from #temp where [name]=@.Table
end
drop table #temp|||Hi
Thanks for this - Yep, wanted to set permissions to over 300 tbales in one go. Wondered if the failure was due to not specifying object types but wasn't sure how to - thanks for your help guys
Cheers
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment