Tony
Tony

Reputation: 12695

TSQL How to exec a stored procedure inside select query?

is it possible to execute a storep procedure inside select query ?

select e.Name, dbo.get_sth e.Id
from emp e

I get the error

Incorrect syntax near 'e.Id'

Upvotes: 2

Views: 5952

Answers (1)

Mark 909
Mark 909

Reputation: 1835

No. But you can execute a function inside a select statement. So recreate your Stored Procedure as a function and this should work.

It will be called for every row so be careful of performance if returning many rows.

Upvotes: 7

Related Questions