• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • No Truncate Table? No Problem!

    March 23, 2011 Hey, Ted

    I am working on a project using DB2 for i, but my experience is with other database management systems. I can’t find the SQL TRUNCATE TABLE statement. Does DB2 cover this functionality some other way?

    –Brad

    Even in 7.1, the latest release, IBM does not implement the TRUNCATE TABLE statement. However, since this statement is included in other DB2 products, as well as in Informix, I expect we’ll see it eventually as part of our world.

    For the benefit of readers who are not familiar with TRUNCATE TABLE, this statement removes all rows of a table (records of a physical file) without dropping the table (deleting the physical file). It is the SQL equivalent of the Clear Physical File (CLRPFM) CL command.

    In the meantime, you have nothing to worry about, because this functionality is indeed covered by a feature of the DELETE statement.

    When you issue a DELETE without a WHERE clause, you are telling the system to remove all records from the table. If the table is small, the database engine will probably delete the rows individually. However, if the table is large, the system may use either a clear operation (when commitment control is not active) or a change file operation (when commitment control is active.)

    I did a quick experiment with two sequential physical files (not SQL tables) that illustrates this point. Commitment control was not active.

    One file had 12 records. After I ran a DELETE without a WHERE, Display File Description (DSPFD) showed zero active records and 12 deleted ones.

    The second file had about 255,000 records. After a DELETE with no WHERE, DSPFD showed zero active records and zero deleted ones.

    Of course, you can always fall back on CLRPFM. It works on all types of physical files, including SQL tables, even when those tables are journaled.

    –Ted



                         Post this story to del.icio.us
                   Post this story to Digg
        Post this story to Slashdot

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    Maxava

    Maxava Partner Webinar: What’s New with IBM PowerVS

    Tonny Bastiaans, IBM’s Worldwide Offering Manager for PowerVS, will share insights into the evolving landscape of IBM’s cloud-based Power platform, while Maxava’s Ash Giddings will discuss how businesses can leverage these advancements for improved flexibility, scalability, and resilience.

    Register Now

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Sponsored Links

    SEQUEL Software:  FREE Webinar: Overcoming query limits with SEQUEL. March 23
    Northeast User Groups Conference:  21th Annual Conference, April 11 - 13, Framingham, MA
    looksoftware:  Integrate IBM i apps with web services. FREE on-demand webinar and white paper!

    IT Jungle Store Top Book Picks

    BACK IN STOCK: Easy Steps to Internet Programming for System i: List Price, $49.95

    The iSeries Express Web Implementer's Guide: List Price, $49.95
    The iSeries Pocket Database Guide: List Price, $59
    The iSeries Pocket SQL Guide: List Price, $59
    The iSeries Pocket WebFacing Primer: List Price, $39
    Migrating to WebSphere Express for iSeries: List Price, $49
    Getting Started with WebSphere Express for iSeries: List Price, $49
    The All-Everything Operating System: List Price, $35
    The Best Joomla! Tutorial Ever!: List Price, $19.95

    Infor Touts License Fee Growth, Expansion Plans Security of SecurID In Question Following Hack of RSA

    Leave a Reply Cancel reply

Volume 11, Number 11 -- March 23, 2011
THIS ISSUE SPONSORED BY:

Bytware
ProData Computer Services
Twin Data Corporation

Table of Contents

  • Taking RSE to Task
  • Today’s Horoscope
  • Admin Alert: Must Your Rack Be IBM Black?
  • Duplicating an Entire Table or a Subset of a Table Using SQL
  • No Truncate Table? No Problem!
  • Automatically Deleting Spooled Files through Expiration Dates

Content archive

  • The Four Hundred
  • Four Hundred Stuff
  • Four Hundred Guru

Recent Posts

  • What You Will Find In IBM i 7.6 TR1 and IBM i 7.5 TR7
  • Three Things For IBM i Shops To Consider About DevSecOps
  • Big Blue Converges IBM i RPG And System Z COBOL Code Assistants Into “Project Bob”
  • As I See It: Retirement Challenges
  • IBM i PTF Guide, Volume 27, Number 41
  • Stacking Up Power11 Entry Server Performance To Older Iron
  • Big Blue Boosts IBM i Support In Instana, Adds Tracing
  • It Is Time To Tell Us What You Are Thinking And Doing
  • IBM i PTF Guide, Volume 27, Number 40
  • The GenAI Boom Is Only Slightly Louder Than The Dot Com Boom

Subscribe

To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

Pages

  • About Us
  • Contact
  • Contributors
  • Four Hundred Monitor
  • IBM i PTF Guide
  • Media Kit
  • Subscribe

Search

Copyright © 2025 IT Jungle