Reputation: 23
I would love to reuse a stored procedure in this situation instead of rewriting the code
IF EXISTS (EXEC [dbo].[SP_JobStop_FindJobByAll] WITH (updlock,serializable)
--IF EXISTS (SELECT * FROM [EZPassDataDB].[dbo].[JobPass] AS [o] WITH (updlock,serializable)
--WHERE [o].[jobNumber] = @jobNumber
Upvotes: 0
Views: 52
Reputation: 88881
You can load the resultset from the stored procedure into a temp table or table variable with INSERT ... EXEC
, eg:
declare @jobs table(...)
insert into @jobs(...)
exec [dbo].[SP_JobStop_FindJobByAll]
if exists (select * from @jobs)
begin
. . .
end
Upvotes: 1