您当前的位置: 首页 >  sql

衣舞晨风

暂无认证

  • 0浏览

    0关注

    1156博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Sql Server 强制断开数据库已有连接的方法

衣舞晨风 发布时间:2015-03-17 21:42:30 ,浏览量:0

用管理员账户sa登陆,然后在master下新建查询:

在查询窗口输入:

declare @i int declare cur cursor for select spid from sysprocesses where db_name(dbid)= '要断开连接的数据库名称' open cur fetch next from cur into @i while @@fetch_status=0 begin exec('kill '+@i) fetch next from cur into @i end close cur deallocate cur 

关注
打赏
1647422595
查看更多评论
立即登录/注册

微信扫码登录

0.0434s