Re: Using results form a stored procedure in an exists clause?
From: Brian Henry (brianiupmsdn_at_newsgroups.nospam)
Date: 04/24/04
- Next message: Dan Guzman: "Re: SQL Errors in Stored Procedures"
- Previous message: Brian Henry: "Re: Querys across two databases"
- In reply to: Tom Moreau: "Re: Using results form a stored procedure in an exists clause?"
- Next in thread: Louis Davidson: "Re: Using results form a stored procedure in an exists clause?"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 24 Apr 2004 11:57:11 -0400
thanks
"Tom Moreau" <tom@dont.spam.me.cips.ca> wrote in message
news:uY$dqLUKEHA.3472@TK2MSFTNGP09.phx.gbl...
> Consider saving the results in a temp table and then running the EXISTS
> against it:
>
> insert #temp
> exec SP_GetIDNumbers
>
> SELECT Persons.*
> from Persons
> where Persons.ID in (select ID from #temp)
>
> <SIDEBAR>
> Don't name your stored proc with an sp_ prefix. This is used for system
> stored procs and can give you some hassles.
> </SIDEBAR>
>
> --
> Tom
>
> ---------------------------------------------------------------
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinnaclepublishing.com/sql
>
>
> "Brian Henry" <brianiupmsdn@newsgroups.nospam> wrote in message
> news:%23WT5UFUKEHA.3016@tk2msftngp13.phx.gbl...
> hi, that doesn't seem to be an option that we can use. Is there any other
> ways?
>
>
> "Eugênio Spolti" <eugenio@designsoftware.com.br> wrote in message
> news:%23T1zxCUKEHA.2776@TK2MSFTNGP12.phx.gbl...
> > Use a UDF instead of Stored procedure
> >
> >
> > "Brian Henry" <brianiupmsdn@newsgroups.nospam> escreveu na mensagem
> > news:OhiYZrTKEHA.1156@TK2MSFTNGP09.phx.gbl...
> > > How would you go about doing something like using the returned table
> from
> > > another stored procedure in a select statement to see if something
> exists
> > in
> > > it
> > >
> > > Say I have stored procedure
> > > SP_GetIDNumbers
> > > which returns a list of ID numbers
> > >
> > > and I want to do this
> > >
> > > SELECT Persons.* from Persons where Perons.ID exists in (stored
> procedure
> > > results)
> > >
> > > thanks, I dont have any DDL, I'm just running this one out of a
question
> > in
> > > my head
> > >
> > >
> >
> >
>
>
- Next message: Dan Guzman: "Re: SQL Errors in Stored Procedures"
- Previous message: Brian Henry: "Re: Querys across two databases"
- In reply to: Tom Moreau: "Re: Using results form a stored procedure in an exists clause?"
- Next in thread: Louis Davidson: "Re: Using results form a stored procedure in an exists clause?"
- Messages sorted by: [ date ] [ thread ]