Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2005
    Posts
    1

    Unanswered: 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

  2. #2
    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

  3. #3
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •