移除sql数据所有链接用户


use master;   go   declare @temp nvarchar(20)   declare myCurse cursor   for   select spid   from sys.sysprocesses   where dbid=DB_ID('数据库名称')--待清理的数据库   open myCurse   fetch next from myCurse into @temp   while @@FETCH_STATUS=0   begin   exec('kill '+ @temp)   fetch next from myCurse into @temp   end   close myCurse   deallocate myCurse;
SQL