SQL Server Administration - User/Login Admin

Add Login

Creates a new SQL Server login to connect using SQL Server authentication. Note: Microsoft states that this function will be deprecated in future release in favor of using Windows Authentication.

Syntax - SQL Server 2005/2008

sp_addlogin [ @loginame = ] 'login' 
    [ , [ @passwd = ] 'password' ] 
    [ , [ @defdb = ] 'database' ] 
    [ , [ @deflanguage = ] 'language' ] 
    [ , [ @sid = ] sid ] 
    [ , [ @encryptopt = ] 'encryption_option' ] 
[;]
GO

--returns 0=ok 1=failed

Example(s) - SQL Server 2005/2008

Creating a SQL Server login

EXEC sp_addlogin 'ericm', 'bluefin87';
GO

Creating a SQL Server login that has a default database

EXEC sp_addlogin 'ericm', 'bluefin97', 'hcmdatamart';
GO

Misc Notes - SQL Server 2005/2008

SQL Server logins can contain:

 Collapse All    Expand All
Custom Search

SQL Server Information and Resources