zoukankan      html  css  js  c++  java
  • 查阻塞

    DECLARE @who TABLE
        (
          spid INT ,
          [status] VARCHAR(30) ,
          login VARCHAR(60) ,
          HostName VARCHAR(80) ,
          Blkby VARCHAR(60) ,
          DBName VARCHAR(80) ,
          Command VARCHAR(MAX) ,
          CPUTime BIGINT ,
          DiskIO BIGINT ,
          LastBatch VARCHAR(200) ,
          Progname VARCHAR(200) ,
          spid_ BIGINT ,
          RequestId INT
        )
    INSERT  INTO @who
    EXEC ('sp_who2') 
    --select * from @who
    
    SELECT  E.text,C.text,A.* FROM    @who A
    LEFT JOIN master.dbo.sysprocesses B ON A.SPID=B.SPID
    CROSS APPLY ::fn_get_sql(B.sql_handle) C
    --LEFT JOIN master.dbo.sysprocesses D ON A.blkby=cast(D.SPID as varchar(30))
    CROSS APPLY ::fn_get_sql(B.sql_handle) E
    where DBName='数据库名'
         and 
         blkby != '  .'
  • 相关阅读:
    C#对象初始化器
    C#构造方法
    C#方法重载
    C#方法
    C#类 对象 字段和属性
    C#数组
    C#字符串
    C#原码反码补码
    字段、方法、属性
    单例模式、异常
  • 原文地址:https://www.cnblogs.com/davidhou/p/5534972.html
Copyright © 2011-2022 走看看