Copy Rows (Data Management)

License Level:BasicStandardAdvanced

Summary

Writes the rows from an input table, table view, feature class, or feature layer to a new table. If a selection is defined on a feature class or feature layer in ArcMap, only the selected rows are copied out.

Usage

Syntax

CopyRows_management (in_rows, out_table, {config_keyword})
ParameterExplanationData Type
in_rows

The rows from a feature class, layer, table, or table view to be copied.

Table View ; Raster Layer
out_table

The table to which the rows will be written. The output table can be saved in a dBASE, ArcSDE geodatabase, file geodatabase, or personal geodatabase, or as an INFO table.

The table to which the rows will be written. The output table can be saved in a dBASE, ArcSDE geodatabase, file geodatabase, or personal geodatabase, or as an INFO table.

Table
config_keyword
(Optional)

The config keyword specifies the default storage parameters for an ArcSDE geodatabase.

String

Code Sample

CopyRows example 1 (Python window)

The following Python window script demonstrates how to use the CopyRows function in immediate mode.

import arcpy
from arcpy import env

env.workspace = "C:/data"
arcpy.CopyRows_management("vegtable.dbf", "C:/output/output.gdb/vegtable")
CopyRows example 2 (stand-alone script)

The following stand-alone script demonstrates how to use CopyRows to copy the tables in a folder to a file geodatabase.

# Name: CopyRows_Example2.py
# Description: Convert all dBASE tables in a folder to geodatabase tables
# Requirement: os module

 
# Import system modules
import arcpy
from arcpy import env
import os
 
# Set environment settings
env.workspace = "C:/data"
 
# Set local variables
outWorkspace = "c:/output/output.gdb"
 
# Use ListTables to generate a list of dBASE tables in the
#  workspace shown above.
tableList = arcpy.ListTables()
 
# Execute CopyRows for each input table
for dbaseTable in tableList:
    # Determine the new output feature class path and name
    outTable = os.path.join(outWorkspace, dbaseTable.strip(".dbf"))
    arcpy.CopyRows_management(dbaseTable, outTable)

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Yes
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
5/7/2015