SQL Server Administration - User/Login Admin

Add Login to Server Role

This stored procedure associates a login to one of the pre-defined SQL Server Roles. The gist of this is to provide more granular audit security.

Syntax - SQL Server 2005/2008

sp_addsrvrolemember 
    sp_addsrvrolemember [ @loginame= ] 'login' 
    , [ @rolename = ] 'role'
GO

Role Must Be One of the Following
sysadmin 
securityadmin 
serveradmin 
setupadmin 
processadmin 
diskadmin 
dbcreator 
bulkadmin 

--returns 0=ok 1=failed

Example - SQL Server 2005/2008

EXEC sp_addsrvrolemember 'RENTON\BillP', 'sysadmin';
GO

Misc Notes - SQL Server 2005/2008

The role membership of the sa and public logins cannot be modified!

 Collapse All    Expand All
Custom Search

SQL Server Information and Resources