trying to exec sp_renamedb - not working

  • HI. I'm trying to rename a databae and I'm getting stuck. I first put the database in single user mode thru EM by clicking on the database, then selecting the OPTIONS tab. then i went to query analyzer and under the context of MASTER i issued exec sp_renamedb 'oldname', 'newname'. When i execute this command i get the following error:

    Database 'GprIns' is already open and can only have one user at a time.

    If I do an sp_who, there is no connection to grpins.

    any suggestions.

    Juanita

     

     

  • use master

    go

    exec sp_renamedb 'pubs', 'pubsnew'

    go

    select * from pubsnew.dbo.authors

    go

    exec sp_renamedb 'pubsnew', 'pubs'

    go

  • Thanks so much. I got it to work !!

    Juanita

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply