Advertisement
Guest User

Untitled

a guest
Apr 24th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. USE [master];
  2.  
  3. DECLARE @kill varchar(8000) = '';
  4. SELECT @kill = @kill + 'kill ' + CONVERT(varchar(5), session_id) + ';'
  5. FROM sys.dm_exec_sessions
  6. WHERE database_id = db_id('progtest')
  7.  
  8. EXEC(@kill);
  9. GO
  10.  
  11. DROP DATABASE [progtest];
  12. GO
  13.  
  14. RESTORE DATABASE [progtest] FILE = N'progdial' FROM DISK = N'C:\TEMP\progdial_backup_2018_03_15_140001_7668977.bak' WITH FILE = 1, MOVE N'progdial' TO N'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\progtest.mdf', MOVE N'progdial_log' TO N'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\progtest.ldf', NOUNLOAD, REPLACE, STATS = 10
  15. GO
  16.  
  17. USE [progtest];
  18.  
  19. update Configuration set value = 1 where label = 'with_vascular_access' or label = 'with_stat_access';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement