Adding logins to Adaptive Server

Use sp_addlogin to add a new login name to Adaptive Server. You do not use it to give the user permission to access user databases. Use sp_adduser for that purpose. Only the System Security Officer can execute sp_addlogin. The syntax is:

sp_addlogin loginame, passwd [, defdb] 
       [, deflanguage [, fullname]]]

where:

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 into 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”) for user 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, you must 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 server 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 human-readable.

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.