Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2011
    Posts
    5

    Unanswered: Dumping the result of the Db2 table count into the .csv file

    Hi,

    I have a following requirement of writing the DB2 SQL Query using the dynamic UNIX shell Scripting. The shell scripting should contain the following

    1. Connect SQL to connect to the DB2 database


    2. How to write the Dynamic DB2 SQL for calculating the source and target record count of a particular table and dump the results of the SQL into the .csv file?

    THe above shell script should export the results to the .csv file when we execute the shell script.

    Thanks,
    Vikram

    Shell Scripting for dumping the result of the Db2 table count into the .csv file

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    what is meant with :source and target record count
    there is only 1 count
    connect to dbname;
    export to xx.csv of del select count(*) from table ;
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  3. #3
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Running SELECT COUNT(*) on all your table can take a long time to run, and you have to do each table separately so getting that into a single CSV can be tedious. If you statistics are up to date just do: SELECT TABSCHEMA,TABNAME,CARD FROM SYSCAT.TABLES. This runs real fast and should be close enough to the actual numbers.

    Andy

Posting Permissions

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