Re: Little database user account script need help...




"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

.



Relevant Pages

  • Re: dbdebunk Quote of Week comment
    ... > a lot of really bad SQL programmers. ... But SQL does not have a pointer data type or the ... > being told to design a database. ... But why is little Cindy Lou Who employee ...
    (comp.databases.theory)
  • Re: DBMS and lisp, etc.
    ... Naively implemented with SQL, again for 10 ... (1 query for the initial orders, 1 query for each order for its ... soon as you upgrade to the SQL database. ... (eq (order-customer orderA) ...
    (comp.lang.lisp)
  • Re: dbdebunk Quote of Week comment
    ... > a lot of really bad SQL programmers. ... a surrogate key should support the primary key. ... But SQL does not have a pointer data type or the ... > being told to design a database. ...
    (comp.databases.theory)
  • Re: dbdebunk Quote of Week comment
    ... But SQL does not have a pointer data type or the ... More and more programmers who have absolutely no database training are ... But why is little Cindy Lou Who employee ...
    (comp.databases.theory)
  • Re: Just say no to threads [Was: Software architecture]
    ... they knew there was going to be a database in the app. ... Now my colleague just spent a couple/three weeks designing an SQL ... Turns out they have a flat file of sample information, ...
    (comp.object)