Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Join on Stored Procedure

Author  Topic 

andrewz00
Starting Member

15 Posts

Posted - 2009-04-17 : 14:45:04
there is already a stored procedure in my db that returns the results i need to "filter" another query im writing...

can i simply join on that sp?

--example

select
E.BadgeCode
from tblEmployee e with (nolock)
INNER JOIN spReportParameter_DS as ds with (nolock)
on E.BadgeCode = DS.BadgeCode

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-04-17 : 14:50:35
nope. you need to first put results of sp to temporary table and then join onto that.

INSERT #Temp
EXEC spReportParameter_DS ....

select
E.BadgeCode
from tblEmployee e with (nolock)
INNER JOIN #Temp as ds with (nolock)
on E.BadgeCode = DS.BadgeCode

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-04-18 : 04:23:00

or join with point 2
http://sqlblogcasts.com/blogs/madhivanan/archive/2007/11/26/select-columns-from-exec-procedure-name-is-this-possible.aspx


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -