473,383 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

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 1130
(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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Dave Smithz | last post by:
Hi, Summary: Best way to divide out the HTML and PHP in some code I inherited. How can I keep the HTML files separate? Full Details: I've now been working two weeks on PHP / MySQL code I...
5
by: M. Akkerman | last post by:
Hi, I've been working on this problem for a while now but I just can't seem to find a good solution for it. Here is the situation. I have the following class class TBigNumber {
65
by: Pmb | last post by:
I'm confused as to what the compiler error message I'm getting is refering to. Can someone take a gander and let me know what I did wrong? The program is below. When I compile it I get the...
2
by: Chris | last post by:
Hi all, I'm wanting to divide a currency total in half but can't think of a way of doing it. The idea is to split a profit text box in two therefore showing 2 amounts which add up to the total...
8
by: Sam Halliday | last post by:
i want to have a function which can print the printable form (possibly a 2 character string) of a character on UNIX like systems. for example, if i were to pass the ascii value '\3', i would like...
3
by: razael1 | last post by:
Let's say I have two classes, Foo and Bar, and a Bar object is a member of Foo. Then I want to have Bar aware of Foo and able to call the public members of it. I can think of two ways to do this:...
2
by: philip | last post by:
hello, i am new to asp.net and sql server, and i have 3 questions for asking: 1. i am writing a store procedure of login validation for my asp.net application and wondering what the different...
3
by: Mitchel | last post by:
I'm kind of new to java & I'm trying to do a grade project called Grade.java Its suposed to make a grade book but I keep on geting 2 errors. Both say return type required. I put the error points in...
3
by: BombDrop | last post by:
Can any one help I have a method that will return a List to be bound as a datasource to a combobox see code for population below. I get the following error when i try to compile Error 29 ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.