2
Reply

Can we rename a database in SQL Server?

18y
4.5k
0
Reply

    Yes. Definitely, using the command

    EXEC sp_dboption 'Employee', 'Single User', 'TRUE'
    EXEC sp_renamedb 'Employee', 'Employee1'
    EXEC sp_dboption 'Employee1', 'Single User', 'FALSE'

    First, you have to be an exclusive user; use sp_dboption as indicated to establish yourself as the sole user of the database. Then, just call sp_renamedb

    18y
    0

    sp_renamedb 'olddatabse','newdatabase'