Nihar,

You can use the OLAP function ROW_NUMBER to retrieve the value you're
looking for.

Regards

Graham Whitmore


-----Original Message-----
From: Nihar Vaidya [mailto:[EMAIL PROTECTED]]
Sent: 13 December 2002 17:29
To: [EMAIL PROTECTED]
Subject: [DB2EUG] Updates and rownums



Assume a table T with columns c1, c2 and c3, all integers. c1 is primary key
and is not null. Let's say T has 2 million rows in it. 1M of these rows have
c2=2. In Oracle, I can do the following:

update T set c2=5 where c2=2 and rownum < 10001;

This SQL updates only 10000 of those 1M rows where c2 was 2.

How do I do this in DB2 ?

Thanks.

- Nihar

-
:::  When replying to the list, please use 'Reply-All' and make sure
:::  a copy goes to the list ([EMAIL PROTECTED]).
***  To unsubscribe, send 'unsubscribe' to [EMAIL PROTECTED]
***  For more information, check http://www.db2eug.uni.cc
-
:::  When replying to the list, please use 'Reply-All' and make sure
:::  a copy goes to the list ([EMAIL PROTECTED]).
***  To unsubscribe, send 'unsubscribe' to [EMAIL PROTECTED]
***  For more information, check http://www.db2eug.uni.cc

Reply via email to