码迷,mamicode.com
首页 > 数据库 > 详细

SqlServer 查看被锁的表和解除被锁的表

时间:2017-02-04 14:39:26      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:type   div   sso   highlight   arc   pre   rom   cas   char   

查看被锁的表

 select   request_session_id   spid,OBJECT_NAME(resource_associated_entity_id) tableName   
    from   sys.dm_tran_locks where resource_type=‘OBJECT‘

  

解除被锁的表

    declare @spid  int 
    Set @spid  = 74 --锁表进程
    declare @sql varchar(1000)
    set @sql=‘kill ‘+cast(@spid  as varchar)
    exec(@sql)

  

原文地址:https://zhidao.baidu.com/question/1947658504489832988.html

SqlServer 查看被锁的表和解除被锁的表

标签:type   div   sso   highlight   arc   pre   rom   cas   char   

原文地址:http://www.cnblogs.com/linkbiz/p/6364356.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!