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

Create Database View

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

Summary

Creates a view in a database based on an SQL expression.

Usage

  • The SQL expression used to define the view is validated by the database upon execution of the tool. Valid syntax for the view definition is determined by the underlying database. If the syntax is incorrect, an error message is returned.

  • Views created in a geodatabase using this tool do not support a forward slash (/) character within the view definition. For example, if you have a column in your create view definition that is based on an expression such as Population1990 / 10, then you would need to create the view using SQL tools.

  • This tool is supported for databases and enterprise, desktop, and workgroup geodatabases. File and personal geodatabases are not supported.

  • Views created in a geodatabase using this tool are not registered with the geodatabase.

  • If a spatial column is included in the view, the geometry storage type of the column must be an SQL data type (such as ST_Geometry or Geometry), not a binary geometry storage type.

Syntax

arcpy.management.CreateDatabaseView(input_database, view_name, view_definition)
ParameterExplanationData Type
input_database

The database that contains the tables or feature classes used to construct the view. This database is also where the view will be created.

Workspace
view_name

The name of the view that will be created in the database.

String
view_definition

An SQL statement used to construct the view.

String

Derived Output

NameExplanationData Type
out_layer

The output database view.

Table

Code sample

CreateDatabaseView example 1 (Python window)

Create a database view in an enterprise geodatabase.

import arcpy
arcpy.CreateDatabaseView_management("c:/Connections/city_data.sde","trees","select objectid, owner, parcel from inventory where type = trees")

Environments

  • Current Workspace

Licensing information

  • Basic: No
  • Standard: Yes
  • Advanced: Yes

Related topics

  • An overview of the General toolset
  • Databases and ArcGIS

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