468,316 Members | 2,131 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,316 developers. It's quick & easy.

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
Sep 15 '08 #1
1 1067
(kr******@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, es****@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
Sep 15 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Dave Smithz | last post: by
5 posts views Thread by M. Akkerman | last post: by
65 posts views Thread by Pmb | last post: by
2 posts views Thread by Chris | last post: by
8 posts views Thread by Sam Halliday | last post: by
3 posts views Thread by razael1 | last post: by
2 posts views Thread by philip | last post: by
3 posts views Thread by BombDrop | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.