Unix Technical Forum

dividing return set into smaller sets

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 ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-16-2008, 12:13 PM
krzys.zg@wp.pl
 
Posts: n/a
Default dividing return set into smaller sets

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 09-16-2008, 12:13 PM
Erland Sommarskog
 
Posts: n/a
Default Re: dividing return set into smaller sets

(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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads for: dividing return set into smaller sets

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


All times are GMT. The time now is 05:07 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com