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 / arpita

We can achieve this by using STRSQL and CPYF commands as
follows -

Type STRSQL, Press Shift + F1, option1 Change session
attributes.Type 3 for SELECT option, specify the output
file name and library (must be created in QTEMP, for a
temporary file). Press ENTER twice.

Then, type the following query -
select * from SAHAA/EMPDATA1
where rrn(EMPDATA1) in(
SELECT distinct dec((rrn(EMPDATA1)/2)) FROM SAHAA/EMPDATA1
) --> use your file and library name

Press Enter, the message File TEMP in QTEMP was created.
Restore the previous session attributes as follows -

Press Shift + F1, option1 Change session attributes.Type 1
for SELECT option. Press ENTER thrice.

Now, we would have half no. of records of EMPDATA1 in file
TEMP (say)

Now, simply use the CPYF command to copy TEMP file data
into EMPDATA1 as follows -

CPYF FROMFILE(QTEMP/TEMP) TOFILE(SAHAA/EMPDATA1) MBROPT
(*REPLACE)

Note:- TEMP is the file temporarily created in QTEMP, so
that it is no longer present in the system when the session
expires.

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I connect my db2 database to ibm?

984


What is a trigger in the db2 database?

1014


What do you mean by commit and rollback?

972


have 3 tables table1, table2 and table3 which contains employee information. table1 is master table, table2 contains emp details like emp no and so on, table 3 contains emp salary. so if any emp leave company between 25th - 30th of every month it has to get updated in tables. but it is not getting updated. What is the reason.

1660


How do I add a column to an existing table in db2?

976


Explain the contents that are a part of dclgen.

1032


What type of database is db2?

908


what is the role of the cursor in db2?

999


What are bind parameters in db2?

979


What are the prerogatives?

1013


What is a db2 collection?

981


What is runstats utility in db2?

961


What is dbrm in db2 database?

1032


How to find schema of a table in db2?

949


What is null value in db2?

945