How to execute a stored procedure inside a select query

前端 未结 7 695
暖寄归人
暖寄归人 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 09:59

    As long as you're not doing any INSERT or UPDATE statements in your stored procedure, you will probably want to make it a function.

    Stored procedures are for executing by an outside program, or on a timed interval.

    The answers here will explain it better than I can:

    Function vs. Stored Procedure in SQL Server

提交回复
热议问题