惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Blog — PlanetScale
Blog — PlanetScale
J
Java Code Geeks
月光博客
月光博客
Engineering at Meta
Engineering at Meta
WordPress大学
WordPress大学
Jina AI
Jina AI
小众软件
小众软件
U
Unit 42
云风的 BLOG
云风的 BLOG
Stack Overflow Blog
Stack Overflow Blog
雷峰网
雷峰网
博客园 - Franky
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
宝玉的分享
宝玉的分享
B
Blog
C
Check Point Blog
爱范儿
爱范儿
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
量子位
阮一峰的网络日志
阮一峰的网络日志
Vercel News
Vercel News
酷 壳 – CoolShell
酷 壳 – CoolShell

博客园 - 东国先生

MongoDB - 安装及相关资料 8种Nosql数据库系统对比 Apache 服务器安装和配置相关资料 ffmpeg: error while loading shared libraries: libavdevice.so.53 亚马逊S3 - The difference between the request time and the current time is too large. Imagick setFont() 不能设置字体问题 当Linux中glibc被无意删除后…… vim终端下中文乱码问题 解决Linux中文乱码 Linux下PHP文件操作提示无权限 zen-cart开发教程 - 通知者/观察者模式 zen-cart开发教程 - 开发Sidebox插件 修改zen-cart下单和付款流程以防止漏单 利用反射设置对象的属性(Property) 【转载】Paypal 标准变量列表 C#中的委托 zen-cart开发教程 - 概述 PHP文件操作函数 2009年终总结
还原sql server数据库时,无法获得对数据库的独占访问权
东国先生 · 2010-08-31 · via 博客园 - 东国先生

declare @dbname   varchar(20)
set @dbname='56fc'
declare   @sql   nvarchar(500)
declare   @spid   int--SPID   值是当用户进行连接时指派给该连接的一个唯一的整数
set   @sql= 'declare   getspid   cursor   for   select   spid   from   sysprocesses   where   dbid=db_id('''+@dbname+''') '
--sysprocesses   包含有关   SQL   Server   进程的信息。
exec   (@sql)
open   getspid
fetch   next   from   getspid   into   @spid
while   @@fetch_status <> -1--如果FETCH   语句没有执行失败或此行不在结果集中。
begin
exec( 'kill   '+@spid)--终止正常连接
fetch   next   from   getspid   into   @spid
end
close   getspid
deallocate   getspid

posted on 2010-08-31 14:16  东国先生  阅读(990)  评论()    收藏  举报