Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

using SP as a table in a select statement

Posted on 2002-05-20
5
Medium Priority
?
255 Views
Last Modified: 2006-11-17
How can i use stored procedure in a select statement as a table
0
Comment
Question by:amnav
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 1

Expert Comment

by:ColinSnelling
ID: 7021126
To the best of my knowledge this is not possible.  I really wish it was as there are a number of occasions where I'd use it myself.

I think that the only thing you can do it put the results of the SP into a temporary table and use that in your SELECT query.

INSERT INTO #myTable exec sp_GetMyResults

Colin
0
 
LVL 25

Accepted Solution

by:
Mr_Peerapol earned 192 total points
ID: 7021247
If you are using MS SQL Server 2000, try converting your stored procedure to user-defined function. Then you will be able to use it in a select statement.

Ex. select * from fn_YourFunction(0, 'Hello')

Or else you need to do like the comment above from ColinSnelling.

Hope it helps,
C
0
 
LVL 35

Assisted Solution

by:David Todd
David Todd earned 192 total points
ID: 7028788
Hi,

The other suggestion is to use the stored procedure to return the record set by passing parameters to it.

Regards
  David
0
 

Expert Comment

by:CleanupPing
ID: 9280477
amnav:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question