|
Posted by Erland Sommarskog on 08/16/07 22:18
rhaazy (rhaazy@gmail.com) writes:
> As it turns out the db_owner is a more likely canidate for the level
> of power I wish to give the user.
>
> So what I need to do is add to my database install script, after I add
> the user to the database, i need to grant Database Role Membership
> (db_owner) for the database ClientScan for the user CSAdmin
>
> exec sp_addlogin 'CSAdmin', 'pwd'
>
> USE ClientScan
> exec sp_adduser 'CSAdmin'
>
> exec sp_addrolemember db_owner, CSAdmin
>
> If there is anything wrong with my syntax please correct it.
Since you are on SQL 2005, I would suggest that you use CREATE LOGIN
and CREATE USER rather than sp_adduser and sp_addlogin.
Note that there is a difference between CREATE USER and sp_adduser: the
latter will create a schema called CSAdmin and make that the default
schema for CSAdmin. If you only use CREATE USER, CSAdmin's default schema
will be dbo, and no schema CSAdmin will be created.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
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
Navigation:
[Reply to this message]
|