Revision history [back]
If you are using sql server 2008
USE [master];
DECLARE @kill varchar(8000) = '';
SELECT @kill = @kill + 'kill ' + CONVERT(varchar(5), session_id) + ';'
FROM sys.dm_exec_sessions
WHERE host_name = ('DBNAME')
EXEC(@kill);
ALTER DATABASE DBNAME
SET READ_COMMITTED_SNAPSHOT ON;
ALTER DATABASE DBNAME
SET ALLOW_SNAPSHOT_ISOLATION ON;
If you are using if sql server 2008
USE [master];
DECLARE @kill varchar(8000) = '';
SELECT @kill = @kill + 'kill ' + CONVERT(varchar(5),session_id) sessionid) + ';'
FROMsys.dm_exec_sessions
sys.dmexecsessions
WHERE host_name hostname = ('DBNAME')
('DBNAME') EXEC(@kill);
READ_COMMITTED_SNAPSHOT ON;
READCOMMITTEDSNAPSHOT ON; ALTER DATABASE DBNAME
SET ALLOW_SNAPSHOT_ISOLATION ON;
SELECT @kill = @kill + 'kill ' + CONVERT(varchar(5),
FROM
EXEC(@kill);
ALTER DATABASE DBNAME SETALLOWSNAPSHOTISOLATION ON;