How to execute a stored procedure inside a select query

前端 未结 7 676
暖寄归人
暖寄归人 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

    "Not Possible". You can do this using this query. Initialize here

    declare @sql nvarchar(4000)=''
    

    Set Value & exec command of your sp with parameters

    SET @sql += ' Exec spName @param'
    EXECUTE sp_executesql @sql,  N'@param type', @param = @param
    

提交回复
热议问题