Adding users to databases

The Database Owner or a System Administrator can use sp_adduser to add a user to a specific database. The user must already have an Adaptive Server login. The syntax is:

sp_adduser loginame [, name_in_db [, grpname]]

where:

sp_adduser adds a row to the sysusers system table in the current database. When a user has an entry in the sysusers table of a database, he or she:

This example shows how a Database Owner could give access permission to “maryh” of the engineering group “eng,” which already exists:

sp_adduser maryh, mary, eng 

This example shows how to give “maryd” access to a database, keeping her name in the database the same as her login name:

sp_adduser maryd 

This example shows how to add “maryj” to the existing “eng” group, keeping her name in the database the same as her login name by using null in place of a new user name:

sp_adduser maryj, null, eng 

Users who have access to a database still need permissions to read data, modify data, and use certain commands. These permissions are granted with the grant and revoke commands, discussed in Chapter 11, “Managing User Permissions.”