建立临时表,插入sp_who执行的所有信息,
create table #temp(...)  --字段包括所有sp_who执行生成的列
insert into #temp exec sp_who然后根据临时表过滤想要的数据
select * from #temp where  blocked=1

解决方案 »

  1.   

    建立临时表变量,插入sp_who执行的所有信息。
    DECLARE @local_variable 声明 table 
    create table @local_variable (...)  --字段包括所有sp_who执行生成的列
    insert into@local_variable exec sp_who然后根据临时表过滤想要的数据
    select * from @local_variable where  blocked=1