直接修改数据库排序,往往都会失败,其实很多时候往往是因为数据库进程的原因,

所以先Kill所有进程,在进行右击数据库-属性-修改排序柜子

以下是kill数据库进场的存储过程,调用之后,再修改数据库排序规则

create   proc   [dbo].[p_killspid]  
@dbname   varchar(200) --要关闭进程的数据库名  
as      
declare   @sql     nvarchar(500)      
declare   @spid   nvarchar(20)  
   
declare   #tb   cursor   for  
select   spid=cast(spid   as   varchar(20))   from   master..sysprocesses   where   dbid=db_id(@dbname)  
open   #tb  
fetch   next   from   #tb   into   @spid  
while   @@fetch_status=0  
begin      
exec('kill   '+@spid)  
fetch   next   from   #tb   into   @spid  
end      
close   #tb  
deallocate   #tb 

相关文章:

  • 2021-04-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-31
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-03-09
  • 2021-06-04
  • 2022-12-23
  • 2022-12-23
  • 2021-11-09
  • 2021-12-16
相关资源
相似解决方案