How will fetch last 5 rows from table in db2

Answer Posted / mahyn

select * from tablename
order by primary_key desc
fetch first 5 rows only
with ur;

can be one way...

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

I HAVE 500 ROW TO UPDATE I WOULD LIKE TO USE ROLLBACK ALONG WITH COMMIT.WHAT IS THE SYNTAX TO CODE COMMIT AND ROLLBACK FOR EVERY 100 ROWS.AND HOW THE CURSOR ROLLBACK TO THE LAST COMMITTING POINT.

2772


Is it possible to alter a table – for example adding a column, when another user is accessing or updating some columns?

644


What is dclgen (declaration generator)?

620


What is precompiler in db2?

605


How to run db2 command in windows?

663






Explain about mirror activator disk mirroring?

569


How many databases can be created inside an instance in db2 ?

616


What is the use of with ur in db2?

632


What are the bind parameters ibm db2?

637


Hello All, We have requirment to Replace BMC Db2 Load product thru CA FAST LOADPlus product. Do anyone have JCL to for FAST LOADPLUS and what all are thing need to take in consideration.

2338


What is runstats db2?

592


What are the contents of dclgen?

671


What are db2 objects?

653


How can you do the explain of a dynamic sql statement?

645


What language is db2 written in?

609