SQL Server 不能创建数据库,发生错误:1807 :未能获得数据库 \'model\' 上的排它锁。请稍后重试操作。
declare @sql varchar(100)
while 1=1
begin
select top 1 @sql = \'kill \'+cast(spid as varchar(3))
from master..sysprocesses
where spid > 50 and spid <> @@spid
if @@rowcount = 0
break
exec(@sql)
end
运行后,即可创建!
while 1=1
begin
select top 1 @sql = \'kill \'+cast(spid as varchar(3))
from master..sysprocesses
where spid > 50 and spid <> @@spid
if @@rowcount = 0
break
exec(@sql)
end
运行后,即可创建!