I have 1000 rows in a db2 table.I want to update first 100
records,How do I do it?

Answers were Sorted based on User's Feedback



I have 1000 rows in a db2 table.I want to update first 100 records,How do I do it?..

Answer / ananth

Declare a cursor like this in the application program
exec sql
Declare empcur cursor with hold for
select empno,empname from emp
for update of empsal
fetch first 100 rows only
end-exec.
this query will retrieve the first 100 rows and the cursor
is positiond at the first row in the resultent table.

Is This Answer Correct ?    23 Yes 1 No

I have 1000 rows in a db2 table.I want to update first 100 records,How do I do it?..

Answer / rama krishna.

UPDATE DB2 SET COL=VAR/EXPR WHERE ROWNUM<=1OO;

Is This Answer Correct ?    1 Yes 6 No

I have 1000 rows in a db2 table.I want to update first 100 records,How do I do it?..

Answer / brooks

is there identity column in this table, for example, if
there is a column indexnum int(supposed start from 1), you
can use the Update Table Set XXX=XXX where indexnum < 101

Is This Answer Correct ?    0 Yes 6 No

I have 1000 rows in a db2 table.I want to update first 100 records,How do I do it?..

Answer / sireesha

SELECT * FROM TABLE WHERE COUNT(*) = 100;

Is This Answer Correct ?    1 Yes 9 No

Post New Answer

More DB2 Interview Questions

Which component is responsible for db2 startup and shutdown?

0 Answers  


What are column-name qualifiers used?

1 Answers  


What is the role of data manager in the db2 database?

0 Answers  


What is meant by explain?

0 Answers  


what is difference between random and sequence file access

1 Answers   Syntel,






How many types of page locks can be held in db2?

0 Answers  


What is performance tuning db2?

0 Answers  


What is -904 sql code? How to resolve it?

3 Answers  


explain about index with examples

2 Answers   Syntel,


what is utility for parm lib

0 Answers   IBM,


What is a trigger in the db2 database?

0 Answers  


What can the Locate option of the Repair Utility accomplish?

2 Answers  


Categories