Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

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

  NAME:  sp_renamedb

  FUNCTION:
       Changes the name of a database.

  SYNTAX:
       sp_renamedb dbname, newname

  EXAMPLES:
       sp_renamedb accounting, financial









  sp_renamedb             Version 4.0 -- 1/15/89                       2
  ______________________________________________________________________
       Renames the accounting database to financial.

  PARAMETERS:
       dbname -  is the original name of the database.
       newname -  is the new name of the database.  Names of objects and
           datatypes must follow the rules for identifiers.

  COMMENTS:

       o Executing sp_renamedb changes the name of a database.
       o Only the System Administrator can change the name  of  a  data-
         base.








  3                       Version 4.0 -- 1/15/89             sp_renamedb
  ______________________________________________________________________
  WARNING  _______________________________________________________________
  |                                                                      |
  |  Procedures, triggers, and views that depend on a database  whose    |
  |  name has been changed work fine until they are recompiled.  How-    |
  |  ever, recompilation takes place for  many  reasons  and  without    |
  |  notification  to the user.  When the procedure, trigger, or view    |
  |  is recompiled by SQL Server, it will no longer work.   The  user    |
  |  must  change its text to reflect the new name of the database on    |
  |  which it depends.  The safest course is to  change  the  defini-    |
  |  tions of any dependent objects when you execute sp_renamedb.        |
  |______________________________________________________________________|


  MESSAGES:
       Only the System Administrator can change database names  and  you
           aren't the System Administrator.
       The database you specified for the old parameter is not currently
           a database.


  sp_renamedb             Version 4.0 -- 1/15/89                       4
  ______________________________________________________________________
       The database you specified for the new  parameter  is  already  a
           database.   Database  names  must  be  unique so you must use
           another name.
       The database name was successfully changed.

  PERMISSIONS:
       Execute permission to object owners for their own objects.   Exe-
       cute permission to Database Owner for all objects.

  TABLES USED:
       master.dbo.sysdatabases

  SEE ALSO:
       sp_helpdb, sp_changedbowner, sp_rename sp_depends,  CREATE  DATA-
       BASE




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