From: DavidC on
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.
--
David


"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.
>
> --
> HTH
> Kalen
> ----------------------------------------
> Kalen Delaney
> SQL Server MVP
> www.SQLServerInternals.com
>
> "DavidC" <dlchase(a)lifetimeinc.com> wrote in message
> news:5A5A0201-AB15-44D4-B8CF-CD4DAFFE9DE8(a)microsoft.com...
> > 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
>