sp_addlogin (version 6.5)

Creates a new SQL Server user by adding an entry to the master.dbo.syslogins system table. A fifth parameter specifies a login suid for the syslogins table to repair an orphan user that occurs as a result of a database load.

For additional syntax information for sp_addlogin, see the Microsoft SQL Server Transact-SQL Reference.

Syntax

sp_addlogin login_id [, password [, defdb [, deflanguage [, login_suid]]]]

where

login_suid
Is the login suid in the syslogins table. If login_suid is NULL the suid is not affected. Use this parameter only when a database user in the sysusers table is an orphan to the syslogins table.

Example

This example creates a SQL Server login for the login ID Victoria. Victoria's password is citybythewater, her default database is products, her language defaults to the system language, and the new login suid in the syslogins table is 44882.

sp_addlogin 'Victoria','citybythewater','products',default,44882

Permission

Only the system administrator can use this stored procedure.