Im looking for a sql command that select all objects and grants permissions, something like below, but to select and grant at the same time, and not to spin out another sql to be executed
select 'grant alter any table on ' + name + ' to USER1' + CHAR(10) + 'go' from sysobjects where type = 'U' or type = 'V' or type = 'P'
UPDATE
Here is the syntax I have to create a proc - I don't have experience on it HELP I have to have a proc that selects all tables and grants permissions to users
create or replace procedure
grant_permissions @table varchar (30) = "sys%"
as
select 'grant alter any table on ' + name + ' to user1' + CHAR(10) + 'go' from sysobjects where type = 'U' or type = 'V' or type = 'P'
go
select 'grant alter any table on ' + name + ' to user2' + CHAR(10) + 'go' from sysobjects where type = 'U' or type = 'V' or type = 'P'
go