Monday, January 12, 2015

Single user to Multi user mode - SQL

select d.name, d.dbid, spid, login_time, nt_domain, nt_username, loginame from sysprocesses p inner join sysdatabases d on p.dbid = d.dbid  where d.name = databasename


kill process1 (resulting from the query above)
kill process 2(resulting from the query above)

kill process n(resulting from the query above)

SET DEADLOCK_PRIORITY HIGH

ALTER DATABASE databasename SET MULTI_USER