ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS 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
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

ValidateTableName

  • Summary
  • Syntax
  • Code sample

Summary

Takes a table name and a workspace path and returns a valid table name for the workspace. An underscore "_" will replace any invalid character found in the table name and will honor the name restrictions for the workspace. The table name restrictions depend on the specific RDBMS used.

Syntax

ValidateTableName (name, {workspace})
ParameterExplanationData Type
name

The table name to be validated.

String
workspace

The optional workspace against which to validate the table name.

If the workspace is not specified, the table name is validated using the current workspace environment. If the workspace environment has not been set, the table name is validated based on a folder workspace.

String

Return Value

Data TypeExplanation
String

The valid table name for the workspace, based on name restrictions of the workspace.

Code sample

ValidateTableName example

Returns a valid table name for the workspace.

import os
import arcpy

# Get the input and output workspaces
#
arcpy.env.workspace = arcpy.GetParameterAsText(0)
out_workspace = arcpy.GetParameterAsText(1)

# Get a list of input feature classes to be copied and copy
#  to new output location
#
for fc in arcpy.ListFeatureClasses():
    out_fc = arcpy.ValidateTableName(fc, out_workspace)
    arcpy.CopyFeatures_management(
        fc, os.path.join(out_workspace, out_fc))

Related topics

  • ParseTableName
  • ValidateFieldName
  • Validating table and field names in Python

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2021 Esri. | Privacy | Legal