当前位置:Gxlcms > 数据库问题 > 清除数据库的关联

清除数据库的关联

时间:2021-07-01 10:21:17 帮助过:2人阅读

@spid int ; declare @ddlstring nvarchar(max); declare @dbname varchar(200); set @dbname=dbName; declare tmpcur cursor for select distinct spid as spid from sys.sysprocesses where dbid=db_id(@dbname) ; OPEN tmpcur; fetch tmpcur into @spid ; while (@@FETCH_STATUS=0) begin print @spid if(@@spid!=@spid)--过滤自己的进程 begin set @ddlstring=NKill +CONVERT( nvarchar,@spid) ; execute sp_executesql @ddlstring ; end fetch tmpcur into @spid ; end ; close tmpcur ; deallocate tmpcur ;

 

清除数据库的关联

标签:

人气教程排行