Use SQL to filter the results of a stored procedure

后端 未结 5 777
悲&欢浪女
悲&欢浪女 2021-02-05 01:41

I\'ve looked at other questions on Stack Overflow related to this question, but none of them seemed to answer this question clearly.

We have a system Stored Procedure ca

5条回答
  •  醉话见心
    2021-02-05 02:07

    The filtering of temporary table is the possible way.

    -- Create tmp table from sp_who results
    CREATE TABLE #TmpWho
    (spid INT, ecid INT, status VARCHAR(150), loginame VARCHAR(150),
    hostname VARCHAR(150), blk INT, dbname VARCHAR(150), cmd VARCHAR(150), request_id INT)
    INSERT INTO #TmpWho
    EXEC sp_who
    
    -- filter temp table where spid is 52
    SELECT * FROM #TmpWho
    WHERE spid = 52
    
    DROP TABLE #TmpWho
    

提交回复
热议问题