miércoles, 3 de septiembre de 2014

eliminacion definitiva


   USE master
   GO
   ALTER DATABASE DBCapacitacion SET  SINGLE_USER WITH ROLLBACK IMMEDIATE
   GO
      IF EXISTS(select * from sys.databases where name='DBCapacitacion')
      DROP DATABASE DBCapacitacion         
   GO
http://stackoverflow.com/questions/12702524/unable-to-drop-and-create-database-in-sql-server
http://dba.stackexchange.com/questions/2387/sql-server-cannot-drop-database-dbname-because-it-is-currently-in-use-but-n
http://www.morgantechspace.com/2013/11/Cannot-drop-database-because-it-is-currently-in-use-in-MS-SQL-Server.html

talvez mejor solucion
  USE master
   GO
      IF EXISTS(select * from sys.databases where name='DBCapacitacion')
         BEGIN
          ALTER DATABASE DBCapacitacion SET  SINGLE_USER WITH ROLLBACK IMMEDIATE
          DROP DATABASE DBCapacitacion         
       END
   GO 

http://chinookdatabase.codeplex.com/workitem/26638

No hay comentarios:

Publicar un comentario