New answers tagged

0

Execute this before doing restore (DBNAME replace with real one): DECLARE @execSql VARCHAR(1000) = ''; SELECT @execSql = @execSql + 'kill ' + CONVERT(CHAR(10), spid) + ' ' FROM master.dbo.sysprocesses WHERE DB_NAME(dbid) = 'DBNAME' AND DBID <> 0 AND spid <> @@spid; EXEC (@execSql)


Top 50 recent answers are included