Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ () — Sybase SQL Server 4.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

  1                       Version 4.0 -- 1/15/89              sp_adduser
  ______________________________________________________________________

  NAME:  sp_adduser

  FUNCTION:
       Adds a new user to the current database.

  SYNTAX:
       sp_adduser loginame [, name_in_db [, grpname]]

  EXAMPLES:
       1)  sp_adduser victoria, victoria, fort_mudge

           SQL Server  login  victoria  has  already   been   added   to







  sp_adduser              Version 4.0 -- 1/15/89                       2
  ______________________________________________________________________
           SQL Server with sp_addlogin.  Now we add him to the database.
           Victoria  will  be  known in the current database by the user
           name victoria and belong to the group fort_mudge  (which  has
           previously been created with sp_addgroup).

       2)  sp_adduser margaret

           Adds margaret to the database.  Her database user name is the
           same  as  her  SQL Server  login  name and she belongs to the
           default group public.

       3)  sp_adduser haroldq, harold, fort_mudge

           Adds haroldq to the database.  When haroldq uses the  current
           database,  his  name is harold.  He belongs to the fort_mudge
           group.




  3                       Version 4.0 -- 1/15/89              sp_adduser
  ______________________________________________________________________

  PARAMETERS:
       loginame -  is the user's name as found in master.dbo.syslogins.
       name_in_db -  is a name for this user in  the  current  database.
           Omitting  this  optional  parameter  causes the name_in_db to
           default to the user's login name.
       grpname -  is the name of an existing group in the database.   If
           you  don't  specify a group, the user becomes a member of the
           default group public.

           If you want to add a user to a group, you must supply a value
           for  the  name_in_db parameter.  The name_in_db parameter can
           be the same as the loginame, or NULL.

  COMMENTS:

       o The Database Owner executes sp_adduser in order to add  a  user
         name  to  the  sysusers table of the current database, enabling


  sp_adduser              Version 4.0 -- 1/15/89                       4
  ______________________________________________________________________
         the user to access the current database under his  or  her  own
         name.

       o Specifying a name_in_db parameter gives the new user a name  in
         the   database   different  from  his  or  her  login  name  on
         SQL Server.  The ability to assign a user a different  name  on
         SQL Server and in a database is provided as a convenience.

         This is not an alias as provided by sp_addalias:  the  user  is
         simply given a different in-database name, and is not mapped to
         the identity and privileges of another user.
       o You can also supply a grpname for the  user.   The  group  must
         already exist in the database.

       o A user can be a member of only one  group.   Every  user  is  a
         member  of the default group, public, if he or she has not been
         explicitly  added  to  some  other  group  with  sp_adduser  or
         sp_changegroup.


  5                       Version 4.0 -- 1/15/89              sp_adduser
  ______________________________________________________________________

       o In order to access a database, a user must either be listed  in
         sysusers (with sp_adduser), mapped to another user in sysalter-
         nates (with sp_addalias), or there must be  a  guest  entry  in
         sysusers.

  MESSAGES:
       The procedure was successful.  The  user  is  now  known  in  the
           current database.
       The loginame you gave is unknown by SQL Server.  Each  user  must
           have a login on SQL Server before he or she can be added to a
           database.
       The name_in_db is already a user in the database.  Choose another
           name.
       The loginame is already known to the database by  an  alias.   If
           you  still  want  to  add  the  user, drop the alias with the
           sp_dropalias procedure and then re-execute sp_adduser.
       The user with the loginame you supplied is listed in the  current


  sp_adduser              Version 4.0 -- 1/15/89                       6
  ______________________________________________________________________
           database's sysusers table with a name different from the  one
           supplied as the name_in_db parameter.
       The group name you supplied does  not  exist  in  this  database.
           Either  omit  the  grpname parameter or create the group with
           sp_addgroup first.

  PERMISSIONS:
       Execute permission to Database Owner.

  TABLES USED:
       sysalternates, sysusers, master.dbo.syslogins

  SEE ALSO:
       sp_addalias,    sp_addgroup,    sp_changegroup,     sp_dropalias,
       sp_dropgroup, sp_helpuser, GRANT, REVOKE, USE




Typewritten Software • bear@typewritten.org • Edmonds, WA 98026