Solved

SELECT SELECT SQL Query Result

Posted on 2007-12-05
6
322 Views
Last Modified: 2010-04-21
I have a SQL query syntax and when i run it, it will return result table in SQL SERVER. What I want is to query using the result. Is that any solution?

Eg. The result returned is a table, and i wish to write select syntax base on the result.
0
Comment
Question by:mycacha
  • 3
  • 3
6 Comments
 
LVL 25

Expert Comment

by:imitchie
ID: 20417116
If this is a stored procedure then you cannot access the result table
0
 
LVL 25

Expert Comment

by:imitchie
ID: 20417122
If it has no side effects, you can turn the SProc into a Table function, so that you can treat it like a table, i.e.

SELECT * FROM dbo.MyTableFunction()
0
 
LVL 25

Accepted Solution

by:
imitchie earned 50 total points
ID: 20417127
If you query is something like

SELECT A,B,C from Table

You can requery the result using

SELECT * FROM
(
SELECT A,B,C from Table
) INNERTABLE
WHERE ....

i.e. put the whole thing in a subquery, give the subquery an alias (i.e. INNERTABLE) and treat it like any table
(which contains the columns of the inner SELECT)
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

Author Comment

by:mycacha
ID: 20417128
Good idea!
can explain detail on how to convert the result set to table?
0
 

Author Comment

by:mycacha
ID: 20417156
Yea, thats the keyword. INNERTABLE. Thanks yea,
0
 

Author Closing Comment

by:mycacha
ID: 31413050
Excellent!
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Creating and Managing Databases with phpMyAdmin in cPanel.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
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.

912 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now