sp_addlogin

Description

Adds a new user account to Adaptive Server; specifies the password expiration interval, the minimum password length, and the maximum number of failed logins allowed for a specified login at creation.

Syntax

sp_addlogin loginame, passwd [, defdb] 
	[, deflanguage] [, fullname] [, passwdexp]
	[, minpwdlen] [, maxfailedlogins]

Parameters

loginame

is the user’s login name. Login names must conform to the rules for identifiers.

passwd

is the user’s password. Passwords must be at least 6 characters long. If you specify a shorter password, sp_addlogin returns an error message and exits. Enclose passwords that include characters besides A-Z, a-z, or 0-9 in quotation marks. Also enclose passwords that begin with 0-9 in quotation marks.

defdb

is the name of the default database assigned when a user logs into Adaptive Server. If you do not specify defdb, the default, master, is used.

deflanguage

is the official name of the default language assigned when a user logs into Adaptive Server. The Adaptive Server default language, defined by the default language id configuration parameter, is used if you do not specify deflanguage.

fullname

is the full name of the user who owns the login account. This can be used for documentation and identification purposes.

passwdexp

specifies the password expiration interval in days. It can be any value between 0 and 32767, inclusive.

minpwdlen

specifies the minimum password length required for that login. The values range between 0 and 30 characters.

maxfailedlogins

is the number of allowable failed login attempts. It can be any whole number between 0 and 32767.

Examples

Example 1

Creates an Adaptive Server login for “albert” with the password “longer1” and the default database corporate:

sp_addlogin albert, longer1, corporate

Example 2

Creates an Adaptive Server login for “claire”. Her password is “bleurouge”, her default database is public_db, and her default language is French:

sp_addlogin claire, bleurouge, public_db, french

Example 3

Creates an Adaptive Server login for “robertw”. His password is “terrible2”, his default database is public_db, and his full name is “Robert Willis”. Do not enclose null in quotes:

sp_addlogin robertw, terrible2, public_db, null, "Robert Willis"

Example 4

Creates a login for “susan” with a password of “wonderful”, a full name of “Susan B. Anthony”, and the server’s default database and language. Do not enclose null in quotes:

sp_addlogin susan, wonderful, null, null, "Susan B. Anthony"

Example 5

An alternative way of creating the login shown in example 4:

sp_addlogin susan, wonderful, @fullname="Susan B. Anthony"

Usage

Permissions

Only a System Administrator or a System Security Officer can execute sp_addlogin.

See also

System procedures sp_addalias, sp_adduser, sp_droplogin, sp_locklogin, sp_modifylogin, sp_password, sp_role