From: DavidC on 16 Apr 2010 09:33
Thanks everyone. I used a subquery and it works fine. I questioned because I
already had a sp exactly like the subquery I ended up with.
"Kalen Delaney" wrote:
> Hi David
> No, a stored procedure cannot be used in an expression. Its invocation is
> always a stand-alone command.
> Why won't a subquery work here to generate the values you need?
> If the logic to compute the return values is absolutely too complex to
> generate in a single query, you could consider a table-valued function. But
> you might want to supply more details here of how the return values are
> determined, and someone here might be able to help you simplify thins.
> Kalen Delaney
> SQL Server MVP
> "DavidC" <dlchase(a)lifetimeinc.com> wrote in message
> > Is it possible to use a stored procedure inside an IN clause? For example
> > below, the stored proc returns a single column of TimeID values.
> > SELECT TimeID
> > FROM dbo.Timesheets
> > WHERE (TimeID IN(EXEC mc_selDuplicateTimesheets))
> > Or is there another workaround? Thanks.
> > --
> > David