If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > How to find rowcount in DB2

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-20-09, 04:31
avishalpatil avishalpatil is offline
Registered User
 
Join Date: May 2009
Posts: 12
How to find rowcount in DB2

Hi all
Could you please provide me the query for rowcount in DB2

Regards
Vishal
Reply With Quote
  #2 (permalink)  
Old 05-20-09, 04:33
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
you mean select count(*) ..
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
  #3 (permalink)  
Old 05-20-09, 04:53
rahul_s80 rahul_s80 is offline
Registered User
 
Join Date: Jul 2006
Location: Pune , India
Posts: 433
get diagnostics
for no of rows impacted in last ins/upd/del
__________________
Rahul Singh
Certified DB2 9 DBA / Application Developer
Reply With Quote
  #4 (permalink)  
Old 05-20-09, 05:20
dr_te_z dr_te_z is offline
Registered User
 
Join Date: Jan 2009
Location: Zoetermeer, Holland
Posts: 555
Code:
D:\Script>db2 -a "update employee set hiredate = hiredate + 1 day where workdept = 'D21'"

SQLCA Information

 sqlcaid : SQLCA     sqlcabc: 136   sqlcode: 0   sqlerrml: 0
 sqlerrmc:
 sqlerrp : SQL09053
 sqlerrd : (1) 0                (2) 0                (3) 7
           (4) 0                (5) 0                (6) 0
 sqlwarn : (1)      (2)      (3)      (4)        (5)       (6)
           (7)      (8)      (9)      (10)       (11)
 sqlstate: 00000
7 rows are updated. this can be derived from the 3rd occurence of sqlerrd.
Reply With Quote
  #5 (permalink)  
Old 05-20-09, 06:51
avishalpatil avishalpatil is offline
Registered User
 
Join Date: May 2009
Posts: 12
I mean......I have to select first two rows from a table.In oracle we can do this like:-->

select * from emp where rownum<=2

How can i achive above query in DB2??

Regards
Vishal
Reply With Quote
  #6 (permalink)  
Old 05-20-09, 07:11
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
select .. fetch first 2 rows only
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On