Skip to content

Instantly share code, notes, and snippets.

@tkMageztik
Created May 4, 2017 17:29
Show Gist options
  • Save tkMageztik/ce2c40f93bfd85885a414b63aec05057 to your computer and use it in GitHub Desktop.
Save tkMageztik/ce2c40f93bfd85885a414b63aec05057 to your computer and use it in GitHub Desktop.
Renombrar base de datos, incluye restricción de base de datos, más potente que hacerlo por GUI
USE MASTER
ALTER DATABASE NOMBRE_ANTIGUO
SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE
GO
sp_rename 'NOMBRE_ANTIGUO', 'NUEVO_NOMBRE' ,'DATABASE';
GO
ALTER DATABASE NUEVO_NOMBRE
SET MULTI_USER
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment