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_defaultdb
  ______________________________________________________________________

  NAME:  sp_defaultdb

  FUNCTION:
       Changes a user's default database.

  SYNTAX:
       sp_defaultdb loginame, defdb

  EXAMPLES:
       sp_defaultdb victoria, pubs

       Sets the default database for victoria to pubs.







  sp_defaultdb            Version 4.0 -- 1/15/89                       2
  ______________________________________________________________________

  PARAMETERS:
       loginame -  is the login name of the user.
       defdb -  is the name of the user's default or  ``home''  database
           (the  database  to which the user is connected when he or she
           logs in).

  COMMENTS:

       o A default database can be set either with sp_defaultdb or  with
         sp_addlogin,   when   the   user's  login  is  first  added  to
         SQL Server.
       o The database to which users are connected if no  default  data-
         base  has  been  specified-either  with  sp_defaultdb  or  with
         sp_addlogin-is master.

       o After sp_defaultdb is executed, the user is  connected  to  the
         new  defdb  the  next  time  he  or she logs in.  However, this


  3                       Version 4.0 -- 1/15/89            sp_defaultdb
  ______________________________________________________________________
         procedure does not automatically give the user access  to  that
         database.   The  Database  Owner  must  give  the user database
         access through sp_adduser or sp_addalias, or there  must  be  a
         guest  user in the database's sysusers table.  If the user does
         not have access to the database by any of these means,  she  or
         he is connected to master and an error message is displayed.

       o If a user's default database is dropped,  or  if  the  user  is
         dropped  from  the database, the user is connected to master on
         his or her next login, and an error message is displayed.
       o The System Administrator can change anyone's  default  database
         with  this  procedure.   All  others  can change only their own
         default database.

  MESSAGES:
       The default database for loginame has been changed successfully.
       There is no login for loginame.  Nothing was changed.



  sp_defaultdb            Version 4.0 -- 1/15/89                       4
  ______________________________________________________________________
       There is no database with the specified name.
       Every user can change his or her own default database,  but  only
           the  System  Administrator  can  change  other users' default
           databases.

  PERMISSIONS:
       Execute permission to public for own login only.  Execute permis-
       sion to System Administrator for any login.

  TABLES USED:
       master.dbo.sysdatabases, master.dbo.syslogins

  SEE ALSO:
       sp_addlogin, sp_droplogin, sp_password, USE





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