ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Truncate Table

  • Summary
  • Usage
  • Syntax
  • Code sample
  • Environments
  • Licensing information

Summary

Removes all rows from a database table or feature class using truncate procedures in the database.

Usage

    Caution:

    If a selection is applied to a layer or table view, the selection will be ignored—all records will be truncated.

  • Supported data types are simple points, lines, or polygons stored in a database. Complex data types such as Terrains, Topologies, or Network Datasets are not supported as input.
  • Versioned data is not supported as input. Data must be unregistered as versioned before the tool will execute successfully.

  • Truncate commands do not utilize database transactions and are unrecoverable. This improves performance over row-by-row deletion.

  • For workflows where all rows are removed from a table or feature class and there is no need to back up the transactions, such as nightly reloading of data, it is recommended that this tool is used to perform the task.

Syntax

TruncateTable_management (in_table)
ParameterExplanationData Type
in_table

Input database table or feature class that will be truncated.

Table View

Code sample

TruncateTable example 1 (Python window)

The following Python window script demonstrates how to use the TruncateTable tool in immediate mode.

import arcpy
arcpy.TruncateTable_management("neil/whistler.sde/function.junction.table")
TruncateTable example 2 (stand-alone script)

The following Python window script demonstrates how to use the TruncateTable tool.

# Name: TruncateTable_Example2.py
# Description: Truncates all tables in a file geodatabase.

# Import system modules
import arcpy

# Set the workspace.
arcpy.env.workspace = "C:/work/vancouver.gdb"

# Get a list of all the tables.
tableList = arcpy.ListTables()

# Loop through the list and run truncate
for table in tableList:
    arcpy.TruncateTable_management(table)

Environments

  • Current Workspace

Licensing information

  • ArcGIS for Desktop Basic: Yes
  • ArcGIS for Desktop Standard: Yes
  • ArcGIS for Desktop Advanced: Yes

Related topics

  • An overview of the Table toolset

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal