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

What is DCLGEN?

2 Answers  


How does one bind 2 versions of a CICS transaction with the same module name in two different CICS regions that share the same DB2 subsystem?

2 Answers  


How can you split a table in to exactly half?

7 Answers   HSBC,


What is the size of a data page?

2 Answers   IBM,


What is filter factor?

2 Answers  






What is error -818 in db2. where can you find the timestamp of the DBRM and the source code.( precompile puts the timestamp on dbrm and source code correct?)

2 Answers  


What is db2 isolation?

2 Answers  


What are iseries servers?

0 Answers  


What is dpf in db2?

0 Answers  


Before you give the explain statement, what are the prerogatives?

0 Answers  


How do you simulate the EXPLAIN of an embedded SQL statement in SPUFI/QMF? Give an example with a host variable in WHERE clause)

2 Answers  


One program calling 5 subprograms, its a cobol db2 program, after precompilation how many plans and packages will created?

3 Answers  


Categories