How to execute a stored procedure inside a select query

前端 未结 7 677
暖寄归人
暖寄归人 2020-12-03 09:26
SELECT col1,
       col2,
       col3,

EXEC GetAIntFromStoredProc(T.col1) AS col4
     FROM Tbl AS T
     WHERE (col2 = @parm) 

How to write this

7条回答
  •  一整个雨季
    2020-12-03 10:18

    You can create a temp table matching your proc output and insert into it.

    CREATE TABLE #Temp (
        Col1 INT
    )
    
    INSERT INTO #Temp
        EXEC MyProc
    

提交回复
热议问题