Re: Logging in irrespective of the database access settings
From: Aaron [SQL Server MVP] (ten.xoc_at_dnartreb.noraa)
Date: 07/16/04
- Next message: Aaron [SQL Server MVP]: "Re: Logging in irrespective of the database access settings"
- Previous message: Dan Guzman: "Re: Logging in irrespective of database access"
- In reply to: Astra: "Re: Logging in irrespective of the database access settings"
- Next in thread: Aaron [SQL Server MVP]: "Re: Logging in irrespective of the database access settings"
- Reply: Aaron [SQL Server MVP]: "Re: Logging in irrespective of the database access settings"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 16 Jul 2004 09:33:24 -0400
Here's one for tables.
DECLARE @u SYSNAME
SET @u = 'someuser'
DECLARE @o SYSNAME, @t SYSNAME
DECLARE tables CURSOR LOCAL STATIC READ_ONLY
FOR
SELECT TABLE_SCHEMA, TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
OPEN tables
FETCH NEXT FROM tables INTO @o, @t
WHILE @@FETCH_STATUS=0
BEGIN
EXEC('GRANT EXEC ON ['+@o+'].['+@t+'] TO ['+@u+']')
FETCH NEXT FROM tables INTO @o, @t
END
CLOSE tables
DEALLOCATE tables
-- http://www.aspfaq.com/ (Reverse address to reply.) "Astra" <info@NoEmail.com> wrote in message news:#$Zr3dzaEHA.2932@TK2MSFTNGP10.phx.gbl... > Dear Aaron > > Many thanks re the below, but how would I put it into a cursor to execute as > well as generate your example scripts. > > Sorry for being a bit thick, but this is all new territory for me.
- Next message: Aaron [SQL Server MVP]: "Re: Logging in irrespective of the database access settings"
- Previous message: Dan Guzman: "Re: Logging in irrespective of database access"
- In reply to: Astra: "Re: Logging in irrespective of the database access settings"
- Next in thread: Aaron [SQL Server MVP]: "Re: Logging in irrespective of the database access settings"
- Reply: Aaron [SQL Server MVP]: "Re: Logging in irrespective of the database access settings"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|