Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / General / Security / August 2006

Tip: Looking for answers? Try searching our database.

sp_adduser 2 times in a row ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Barb - 24 Aug 2006 21:03 GMT
Hi,

      I did EXEC sp_adduser 'Vidur', 'Vidur', 'Recruiting'
      And now I see the user Vidur.

      What will happen if I'm doing

      EXEC sp_adduser 'Vidur', 'Vidur', 'HR'?
     The user will be updated with this new role?

Thanks.
Jack
Hari Prasad - 25 Aug 2006 13:15 GMT
Hi,

For adding the role you have to use the system procedure sp_addrolemember.

EXEC sp_addrolemember HR, 'Vidur'

Thanks
Hari
SQL Server MVP

> Hi,
>
[quoted text clipped - 8 lines]
> Thanks.
> Jack
Dan Guzman - 25 Aug 2006 13:47 GMT
>       EXEC sp_adduser 'Vidur', 'Vidur', 'HR'?
>      The user will be updated with this new role?

No, you will get an error because the user already exists.

Keep in mind that a user can be a member of multiple roles.  The sp_adduser
@grpname parameter is only for convenience when adding a new user.  Use
sp_droprolemember to remove membership and sp_addrolemember to add a user to
a role.

Signature

Hope this helps.

Dan Guzman
SQL Server MVP

> Hi,
>
[quoted text clipped - 8 lines]
> Thanks.
> Jack
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.