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
 General SQL Server Forums
 New to SQL Server Programming
 Need help with SELECT statement with EXECUTE proc.

Author  Topic 

wgp3
Starting Member

1 Post

Posted - 2009-06-24 : 09:37:22
Hello all,
I'm new to SQL Server but have a good bit of Oracle experience. I'm trying to find examples or any documentation to construct a statement like:

Select column1, column2 from execute(myproc, param1, param2) where something = 1

Any help with this would be appreciated.

Thanks,
Whitney

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2009-06-24 : 09:42:53
Guessing what you are trying to, you need to get the results into a temp table and then select from it..


INSERT INTO #tmp EXECUTE ....

SELECT * FROM #tmp





Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-06-24 : 09:44:16
You can use OPENROWSET with linked server/remote server set to self.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-06-24 : 09:44:49
Or rewrite the stored procedure as a function?



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-06-24 : 10:36:14
Method 2 is example of Peso's suggestion 1
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 -