Adding logins to Adaptive Server

Use sp_addlogin to add a new login name to Adaptive Server. (Use sp_adduser to give permission to access user databases.) Only the system security officer can execute sp_addlogin.

See the Reference Manual: Procedures for complete sp_addlogin syntax.

The following statement sets up an account for the user “maryd” with the password “100cents,” the default database (master), the default language, and no full name:

sp_addlogin "maryd", "100cents"

The password requires quotation marks because it begins with 1.

After this statement is executed, “maryd” can log in to Adaptive Server. She is automatically treated as a “guest” user in master, with limited permissions, unless she has been specifically given access to master.

The following statement sets up a login account (“omar_khayyam”) and password (“rubaiyat”) and makes pubs2 the default database for this user:

sp_addlogin omar_khayyam, rubaiyat, pubs2

To specify a full name for a user and use the default database and language, specify null in place of the defdb and deflanguage parameters. For example:

sp_addlogin omar, rubaiyat, null, null, 
    "Omar Khayyam"

Alternatively, you can specify a parameter name, in which case you do not have to specify all the parameters. For example:

sp_addlogin omar, rubaiyat, 
    @fullname = "Omar Khayyam"

When you execute sp_addlogin, Adaptive Server adds a row to master.dbo.syslogins, assigns a unique system user ID (suid) for the new user, and fills in other information. When a user logs in, Adaptive Server looks in syslogins for the name and password provided by the user. The password column is encrypted with a one-way algorithm so it is not readable.

At login creation, the crdate column in syslogins is set to the current time.

The suid column in syslogins uniquely identifies each user on Adaptive Server. A user’s suid remains the same, no matter what database he or she is using. The suid 1 is always assigned to the default “sa” account that is created when Adaptive Server is installed. Other users’ server user IDs are integers assigned consecutively by Adaptive Server each time sp_addlogin is executed.