Re: Little database user account script need help...
- From: "Andy" <aweaver@xxxxxx>
- Date: Mon, 31 Mar 2008 09:16:51 -0400
"Erland Sommarskog" <esquel@xxxxxxxxxxxxx> wrote in message news:Xns9A704832B7A4Yazorman@xxxxxxxxxxxx
Andy (aweaver@xxxxxx) writes:Hi there, I found this script on Microsoft's site for creating a
Database, User, and Account in SQL 2005, it works really well and I like
it alot, does anyone know how I can modify it to allow that user to
view/edit their database via the Microsoft SQL Server Management
Studio?
I tried adding this:
set @sql = 'USE ' + QUOTENAME(@db_name) + char(10) +
'exec sp_addrolemember ''db_owner'', ''' +
REPLACE(@login_name, '''', '''''') + ''''
execute( @sql )
And? Did it work?
I'm not really sure what your question is, but you do the above a little
bit easier:
SELECT @sp_addrolemember = quotename(@db_name) + '.sys.sp_addrolemember
EXEC @sp_addrolemember db_owner, @login_name
Yes, they don't do that in the MS script, but MS does not always themselves
know of all niceties in their products.
Oh, and sorry if my question was ambiguous, it was: How can I make it so that the user can view their database in the Microsoft SQL Server Management Studio in even though I have:
set @sql = 'DENY VIEW ANY DATABASE TO ' + QUOTENAME(@login_name)
set for them.
thanks,
Andy
.
- References:
- Little database user account script need help...
- From: Andy
- 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...
- Previous by thread: Re: Little database user account script need help...
- Next by thread: Re: whats is wrong here????
- Index(es):
Relevant Pages
|
|