sp_AddUserToGroup

Advantage SQL Engine

Makes a database user member of a user group.

Syntax

sp_AddUserToGroup(

UserName,CHARACTER,50,

GroupName,CHARACTER,100 )

Parameters

UserName (I)

Name of the database user object that will become a member of the user group.

GroupName (I)

Name of the database user group object to make the user a member of.

Special Return Codes

AE_INVALID_OBJECT_NAME

Either the GroupName does not specify a valid user group in the database or the UserName does not specify a valid database user.

AE_ALREADY_MEMBER_OF_GROUP

The user is already a member of the specified user group.

Remarks

sp_AddUserToGroup makes the user a member of the specified user group. Once the user is a member of the user group, the user inherits rights to all objects that the user group has. If the user group’s object access rights changes, the user’s inherited rights will change accordingly. A user can be member of multiple user groups. The user’s effective right to a database object (table, view or stored procedure) is the summation of all inherited rights the user have from all user groups that the user is a member of.

Example

After making a connection to the database, add user "rsmith" to the user group "Managers". If the "Managers" has read and write rights to the table "employees", the user "rsmith" will now have rights to open the "employees" table for read and write purpose.

EXECUTE PROCEDURE sp_AddUserToGroup(

‘rsmith’,

‘Managers’ );

See Also

sp_CreateGroup

sp_DropGroup

sp_CreateUser

sp_DropUser

sp_RemoveUserFromGroup