Skip To Content

Create Database Sequence


Creates a database sequence in an enterprise geodatabase. You can use the database sequences in custom applications that access the enterprise geodatabase.


  • This tool can be used with geodatabases in IBM Db2, Microsoft SQL Server, Oracle, PostgreSQL, and SAP HANA.


CreateDatabaseSequence_management (in_workspace, seq_name, {seq_start_id}, {seq_inc_value})
ParameterExplanationData Type

The database connection (.sde) file to connect to the geodatabase in which you want to create a sequence. The user specified in the database connection is the owner of the sequence and must have the following permissions in the database:

  • Db2—CREATEIN privilege on their schema
  • Oracle—CREATE SEQUENCE system privilege
  • PostgreSQL—Authority on their schema
  • SAP HANA—Must be a standard user
  • SQL Server—CREATE SEQUENCE privilege and ALTER OR CONTROL permission on their schema


A name for the database sequence. The name must meet sequence name requirements for the database platform you're using and must be unique in the database. Be sure to remember this name, as it is the name you use in your custom applications and expressions to invoke the sequence.


A starting number for the sequence. If you do not provide a starting number, the sequence starts with 1. If you do provide a starting number, it must be greater than 0.


Describes how the sequence numbers will increment. For example, if the sequence starts at 10 and the increment value is 5, the next value in the sequence is 15, and the next value after that is 20. If you do not specify an increment value, sequence values increment by 1.


Derived Output

NameExplanationData Type

The updated input workspace.


Code sample

CreateDatabaseSequence example (Python window)

Create a database sequence named custom_sequence that starts with 1 and increments by 1.

import arcpy
                                        "custom_sequence", 1, 1)


This tool does not use any geoprocessing environments.

Licensing information

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

Related topics