By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,377 Members | 1,354 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,377 IT Pros & Developers. It's quick & easy.

calling stored procedure

P: 90
Is there a posibility to call a stored procedure inside subquery? if so how?
Mar 17 '08 #1
Share this Question
Share on Google+
5 Replies


P: 92
select * from myTable
where ID = (exec dbo.myProc(@param1,@param2)) --if myProc returns a value
Mar 17 '08 #2

deepuv04
Expert 100+
P: 227
Is there a posibility to call a stored procedure inside subquery? if so how?
Hi,
It is not possible to call a stored procedure inside a subquery, instead use function or
dump the data into temporary table and work on it.

Thanks
Mar 17 '08 #3

debasisdas
Expert 5K+
P: 8,127
You can't call a procedure inside a sub query . Use a function instead.
Mar 17 '08 #4

P: 92
sorry.. was thinking of functions, instead of stored procedures, in my previous post..
Mar 18 '08 #5

deepuv04
Expert 100+
P: 227
sorry.. was thinking of functions, instead of stored procedures, in my previous post..
[code =sql]
if the function is returning single value
SELECT dbo.Function_Name(parameter_list) .....
WHERE dbo.Function_Name = value

if the function is returning a table then
SELECT * from dbo.Function_Name(parameter_list) .....
[/code]
Mar 18 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.