This is a discussion on dividing return set into smaller sets within the SQL Server forums, part of the Microsoft SQL Server category; --> Hi, I have a problem with t-sql query. Let's assume, that i have a query selest * from table01 ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, I have a problem with t-sql query. Let's assume, that i have a query selest * from table01 which return a dataset: | Colum1 | Column2 ------------------------------------- R1| A | B R2| C | D R3| E | F R4| G | H but I need return few dataset (as many as rows), as shown: | Colum1 | Column2 ------------------------------------- R1| A | B | Colum1 | Column2 ------------------------------------- R2| C | D | Colum1 | Column2 ------------------------------------- R3| E | F etc.... and I can not use cursors. Do you have any idea how to solve this? I appreciate any suggestion. Thank you very much in advance, Christopher |
| ||||
| (krzys.zg@wp.pl) writes: > I have a problem with t-sql query. > > Let's assume, that i have a query > > selest * from table01 > > which return a dataset: > > | Colum1 | Column2 > ------------------------------------- > R1| A | B > R2| C | D > R3| E | F > R4| G | H > > but I need return few dataset (as many as rows), as shown: > > | Colum1 | Column2 > ------------------------------------- > R1| A | B > > | Colum1 | Column2 > ------------------------------------- > R2| C | D > > | Colum1 | Column2 > ------------------------------------- > R3| E | F > > etc.... > > and I can not use cursors. > > Do you have any idea how to solve this? I appreciate any suggestion. I would suggest that you give the full story about why you feel compelled to ask for this. Then maybe we can find a better solution to your underlying problem. To wit, this is such a funny request, that all answers will also be funny, so there is all reason to look for a better solution. -- Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se Books Online for SQL Server 2005 at http://www.microsoft.com/technet/pro...ads/books.mspx Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinf...ons/books.mspx |
| Thread Tools | |
| Display Modes | |
|
|
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Calling SQL functions that return sets | Chris Mungall | pgsql Sql | 3 | 04-19-2008 12:34 PM |
| Re: [COMMITTERS] pgsql: Allow PL/python to return composite types and result sets Sven | Tom Lane | pgsql Hackers | 5 | 04-12-2008 05:20 AM |
| Recursive calls to functions that return sets | Thomas Hallgren | pgsql Hackers | 10 | 04-12-2008 02:41 AM |
| pgsql: Allow PL/python to return composite types and result sets Sven | Bruce Momjian | pgsql Committers | 0 | 04-10-2008 07:53 PM |
| how to get the cursor to return 2 sets of values | happyardy@gmail.com | Oracle Miscellaneous | 0 | 04-08-2008 11:02 AM |