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 > Echoing the name of the table along with the number of records it contains

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-21-05, 04:32
pgesmundo pgesmundo is offline
Registered User
 
Join Date: Jan 2005
Posts: 1
Echoing the name of the table along with the number of records it contains

Hi all,

I am faily new to DB2

in Oracle I can do something like:

select 'TABLENAME - ' || count(*) from TABLENAME

DB2 does not seem to support this and throws an SQL0104N error.

Is there a way to write this for DB2?

Thanks
PAolo
Reply With Quote
  #2 (permalink)  
Old 01-21-05, 05:35
jdey123 jdey123 is offline
Registered User
 
Join Date: Aug 2004
Location: London, UK
Posts: 31
Not entirely sure if this is what you mean

But,
select 'tablename - '||cast(count(*) as char(10)) from tablename;

I didn't get the sql0104 error when I typed in what you specified, hence my confusion.


jdey@macehill.co.uk
Reply With Quote
  #3 (permalink)  
Old 01-21-05, 12:43
nidm nidm is offline
Registered User
 
Join Date: May 2003
Posts: 113
select 'TABLENAME - ' || CHAR(COUNT(*)) from TABLENAME



Quote:
Originally Posted by pgesmundo
Hi all,

I am faily new to DB2

in Oracle I can do something like:

select 'TABLENAME - ' || count(*) from TABLENAME

DB2 does not seem to support this and throws an SQL0104N error.

Is there a way to write this for DB2?

Thanks
PAolo
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