Label | Explanation | Data Type |
Input Table
| The input database table or feature class that will be truncated. | Table View |
Derived Output
Label | Explanation | Data Type |
Truncated Table | The truncated table. | Table View |
Removes all rows from a database table or feature class using truncate procedures in the database.
If a selection is applied to a layer or table view, the selection will be ignored and 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, and network datasets are not supported as input.
The input database table or feature class must be from a database connection established as the data owner.
Versioned data is not supported as input. Data must be unregistered as versioned before the tool will run successfully.
Truncate commands do not use database transactions and are unrecoverable. This improves performance over row-by-row deletion.
It is recommended that you use this tool for workflows in which 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.
This tool supports a feature service layer as input when connected as a user that can administer the service and the supportsTruncate service property is true.
Label | Explanation | Data Type |
Input Table
| The input database table or feature class that will be truncated. | Table View |
Label | Explanation | Data Type |
Truncated Table | The truncated table. | Table View |
arcpy.management.TruncateTable(in_table)
Name | Explanation | Data Type |
in_table | The input database table or feature class that will be truncated. | Table View |
Name | Explanation | Data Type |
out_table | The truncated table. | Table View |
The following Python window script demonstrates how to use the TruncateTable function in immediate mode.
import arcpy
arcpy.TruncateTable_management("neil/whistler.sde/function.junction.table")
The following Python window script demonstrates how to use the TruncateTable function.
# 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)