Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How can you split a table in to exactly half?

Answer Posted / reddy kanupuru

Hi,

Here i am giving the procedure , how to make the table into
half..... using program... I dont know whether any direct
SQL command is there or not. This is just for ur idea what
i know.

1) Find the total number of rows in a table using count(*)

2) Declare two variable in working storage section.
eg: 02 A pic 9(4) .
02 B pic 9(2).

store the count no into one variable .assume u stored that
in A.

then divide that by 2. so u will get half of the rows in a
table. strore that value in B.

3) Take another variable name C .

eg: 02 c pic 9(4) value 0.

perform para1 until B =C

para1:

Retrive the row from the table.

move to corresponding host variables ( use table to store
muliple rows ).

insert into table(u can insert multiple rows at a time ...)

do the same for storing the other half into the another
table.

means here 1 st half rows were stored in one temp
table .... the other in the one table.

Is This Answer Correct ?    4 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to find schema of a table in db2?

1008


How do you select a row using indexes in db2?

1131


what is db2 restart?

2147


When the like statement is used?

1222


What is null indicator in cobol db2?

1060


How is a typical db2 batch pgm executed?

1171


Give a brief description of db2 isolation levels?

1061


Why db2 is called db2?

1033


What is check constraint. Explain with example.

1098


What is sqlca?

1062


What is a system catalog table in db2?

1182


What is db2 connect?

1063


Explain various types of locks in db2?

1138


What is difference between rollback and commit?

1153


How will you return the number of records in table?

932