Solved

sql server stored procedure

Posted on 1998-12-16
2
175 Views
Last Modified: 2011-09-20
In a SQL Server Stored Procedure, is it possible to define a recordset and populate it with a select statement? Example would be "Set RS = db.openrecordset("Select * from table1). Then use the recordset and join it with another select * from table2. This would give the final result set for the final report builder.

Thanks
CM
0
Comment
Question by:milstead
2 Comments
 
LVL 2

Expert Comment

by:tschill120198
ID: 1092313
Why not do the join first (all in SQL) and then retrieve it into a single recordset?  
0
 
LVL 7

Accepted Solution

by:
spiridonov earned 10 total points
ID: 1092314
There are no such thing as 'recordset' in T-SQL. but you can create temprary table and then use it:
SELECT a,b,c
INTO #temp_result
FROM table_a
.
SELECT a,b,c,d
FROM tble_b,#temp_result
WHERE ...
0

Featured Post

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

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

Suggested Solutions

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

740 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