Re: Little database user account script need help...
- From: "Andy" <aweaver@xxxxxx>
- Date: Mon, 31 Mar 2008 09:13:58 -0400
Erland,
Ah. No it doesn't work for me because I have set @sql = 'DENY VIEW ANY DATABASE TO ' + QUOTENAME(@login_name)
is there a way to change it to be:
GRANT VIEW db_name to login_name ?
I've tried like 30 different combinations and looked in the books online documentation and it didnt seem to work, and no matter how I word the script it always creates the DB with DBO = administrator
"Erland Sommarskog" <esquel@xxxxxxxxxxxxx> wrote in message news:Xns9A7185E154445Yazorman@xxxxxxxxxxxx
Uri Dimant (urid@xxxxxxxxxxx) writes:ErlandSELECT @sp_addrolemember = quotename(@db_name) + '.sys.sp_addrolemember
EXEC @sp_addrolemember db_owner, @login_name
How does this script work? I cannot run it on SS2005 sp2
There is a single quote missing on the first line.
The tricks are two:
1) EXEC @var runs the procedure in @var
2) EXEC some_db..sp_systemproc, runs that system procedure in the context of
the some_db database.
What happened when you tried the above?
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.
- References:
- Little database user account script need help...
- From: Andy
- Re: Little database user account script need help...
- From: Erland Sommarskog
- Re: Little database user account script need help...
- From: Uri Dimant
- Re: Little database user account script need help...
- From: Erland Sommarskog
- Little database user account script need help...
- Prev by Date: Re: Little database user account script need help...
- Next by Date: Re: Little database user account script need help...
- Previous by thread: Re: Little database user account script need help...
- Next by thread: Re: Little database user account script need help...
- Index(es):
Relevant Pages
|
|