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
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 |
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 |
Answer / rama krishna.
UPDATE DB2 SET COL=VAR/EXPR WHERE ROWNUM<=1OO;
| Is This Answer Correct ? | 1 Yes | 7 No |
Explain how can you do the explain of a dynamic sql statement?
what is REORG? what is the use?
What does runstats do in db2?
Write a query to extract first 5 characters of a name in the column Stud_Name?
How can you count the number of rows from a table tab?
What is the difference between dbm cfg and db cfg file in db2 ?
What is correlation names?
Explain the contention situations caused by locks?
COBOL PRECOMPILER ERROR: "XXXXXX" (TABLE) PREVIOUSLY DECLARED OR REFERENCED DCLGEN VARIABLES GETS IMPORTED TWICE FOR ONLY ONE EXEC SQL STATEMENT. WHAT COULD BE THE PROBLEM?
How to resolve -818 sql code in DB2?
what is the steps followed in EXPLAIN Process or EXPLAIN command. (Explain is for identifying the optimized access path but how or what is the steps for doing the EXPLAIN)
What is database alias db2?