当前位置:网站首页>SQLSERVER database restore stored procedure script

SQLSERVER database restore stored procedure script

2022-06-23 02:27:00 FHAdmin

 Stored procedures must be created in the master in 
#from fhadmin.cn
create proc killspid (@dbname varchar(20))        
as        
begin         
declare @sql   nvarchar(500)       
declare @spid  int         
set @sql='declare getspid cursor for select spid from sysprocesses where  dbid=db_id('''[email protected]+''')'     
exec (@sql)     
open getspid      
fetch next from getspid into @spid   
while @@fetch_status <> -1      
begin
exec('kill '[email protected])
fetch next from getspid into @spid 
end 
close getspid
deallocate getspid 
end  
原网站

版权声明
本文为[FHAdmin]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202071240299820.html