sde2tbl

The sde2tbl command converts geodatabase tables to INFO and dBASE tables. You can also use sde2tbl to selectively copy columns from one ArcSDE geodatabase table to a new ArcSDE geodatabase table.

Note: This function is not supported on 64-bit Windows, Linux, or HP-Itanium.

Usage syntax

From a feature class:

sde2tbl -o append -t <table> -f <file_name> -T {dBASE | INFO | SDE}
[-I] [-a {all | file=<file_name>}] [-c <commit_interval>]
[-i {<service> | <port#> | <direct connection>}] [-s <server_name>]
[-D <database_name>] -u <DB_user_name> [-p <DB_user_password>]
[-v] [-w <"where_clause">]
 

sde2tbl -o create -t <table> -f <file_name> -T {dBASE | INFO | SDE}
[-I] [-a {all | file=<file_name>}] [-c <commit_interval>]
[-k <config_keyword>] [-w <"where_clause">] [-s <server_name>]
[-i {<service> | <port#> | <direct connection>}] [-D <database_name>]
-u <DB_user_name> [-p <DB_user_password>] [-v]
 

sde2tbl -o init -t <table> -f <file_name> -T {dBASE | INFO | SDE}
[-I] [-a {all | file=<file_name>}] [-c <commit_interval>]
[-i {<service> | <port#> | <direct connection>}] [-s <server_name>]
[-D <database_name>] -u <DB_user_name> [-v]
[-p <DB_user_password>] [-w <"where_clause">]
 

sde2tbl -h

sde2tbl -?

Operations

Operation Description
append Adds records to an existing geodatabase, dBASE, or INFO table (the default)
create Creates a new table and imports records into it; an error is returned if the table already exists.
init Deletes all records in an existing DBMS table before importing new records

 

Options

Options Description
-a Attribute modes

all: Loads all columns (the default)

If the table exists, the incoming schema must be union compatible with the table if using the append or init option.

file=<file_name>: File containing lines in the form <fr_colName> [to_colName] [type] [size] [nDecs] [NOT_NULL]

The fr_colName is the column from the table being brought into the geodatabase, while the to_colName is the new name of the column in the table in the ArcSDE geodatabase. The type specifies a legal data type. The size is the maximum size of the column and nDecs the number of digits to the right of the decimal point for floating point data types. NOT NULL, if specified, requires that the column must have a nonNULL value.

Supported types include the following:
INT16
INT32
INT64
FLOAT32
FLOAT64
STRING
NSTRING
DATE

Note: Mapping a numeric column type into a string column type and mapping a string column type to a numeric column type are not permitted.

The allowed type, size, and nDecs (number of decimal places) values will vary according to each DBMS.

-c Commit rate (default is the AUTOCOMMIT value from giomgr.defs); only used when the output table type is SDE.
-D Database name (not supported on Oracle)
-f Output table name; define the table type with the -T option
-h or -? Use either of these options to see the usage and options for the command. Note: If using a C shell, use -h or "-\?".
-i ArcSDE service name, port number, or direct connection information (default: esri_sde or 5151)
-I Disable buffered inserts (default: ON); only used when the output table type is SDE.
-k Configuration keyword from DBTUNE table (default: DEFAULTS); only used when the table is output to an ArcSDE geodatabase
-o Operation
-p DBMS user password
-s ArcSDE server host name (default: localhost)
-t Input ArcSDE table name
-T Output table type, either dBASE, INFO, or SDE
-u DBMS user name
-v Verbose option; reports records committed at the commit interval
-w SQL WHERE clause

 

Discussion

This command converts tables in an ArcSDE geodatabase to INFO and dBase tables. The column types it converts to are:

Type Width Description Storage
B 10 Binary field No
C 1-254 Character Yes
D 8 Date Field specified as 8 ASCII characters in YYYYMMDD format Yes
F 1-20 Numeric floating point field See below
G 10 General field No
L 1 Logical field Yes
M 10 Memo field No
N 1-19 Numeric fixed position field Yes
P 10 Picture field No
V 10 Variable field No

The dBASE F-type column will not be created in the resultant dBASE table, but ArcSDE will write to an existing F-type column. The sde2tbl init or create operations will not create an F-type column, but the sde2tbl append operation will write into a dBASE table containing an existing F-type. The tbl2sde command will read an F-type column.

The "from" column types vary by DBMS.

It also allows you to selectively copy columns from a geodatabase table into a new geodatabase table. To do this, you use a WHERE clause to specify which columns will be moved to the new table. When copying columns from an existing geodatabase table to another geodatabase table, you can specify a configuration keyword and commit rate, as well as disable buffered inserts.

Note: If you have altered column definitions using a SQL interface while the data was stored in an ArcSDE geodatabase, exporting the data may fail. 

 

Examples

Add records to a table

To add more records to an existing geodatabase, INFO, or dBASE table, use the append operation.

sde2tbl -o append -t hotels.pat -f hotels -T INFO -u av

Create a new table

Use the create operation to create a new table. Be sure to specify the type of table created: SDE, INFO, or dBASE. The following example converts a geodatabase table, block_attr, to a dBASE table called census_data.

sde2tbl -o create -t block_attr -f census_data -T dBASE -a all -u av -p mo

You can also use the sde2tbl command to convert STRING columns to NSTRING (Unicode). This is done using the -a option with the create operation to specify a file that contains the definition for the attribute columns in the table. In the file, the entries should be in the following format:

<fr_ColName> [to_ColName] [type] [size] [nDecs] [NOT_NULL]

The fr_ColName is the column name in the source table, the to_ColName is the new name of the column in the new table. The type specifies a legal data type. The size is the maximum size of the column and nDecs the number of digits to the right of the decimal point for floating point data types. NOT NULL, if specified, requires that the column must have a nonNULL value.

As indicated by the brackets, all but the first parameter is optional. If you do not supply values for the other parameters, default values are used. In the case of type, if the data type was character in the source table, the default in the table in the geodatabase will be STRING. Therefore, to create an NSTRING column, you must specify the type.

If you do not specify the NOT_NULL parameter, the column in the new table will allow null values. If you do not specify to_ColName, size, or nDecs, they will be the same as they were in the source table.

For example, an existing table, blocks, in the ArcSDE geodatabase has the following characteristics:

Column name    Attribute type       Null?        Length,DPs      RowID Column?

ID               SE_INT32         NOT NULL        10                SDE set

BLOCK            SE_STRING        NULL             4  

You could convert the BLOCK column to type SE_NSTRING using a file and the sde2tbl -o create command.

Create a file, block_defs, containing these entries:

ID ID INT32 10 0 NOT_NULL

BLOCK BLOCK NSTRING 4 0

Next, execute sde2tbl -o create, making a new table with a different name in the same geodatabase and using the column definitions in the block_defs file.

sde2tbl -o create -t blocks_uni -T SDE -a ./block_defs.ccf -i 7000 -u lobo

Remove the records from an existing table then load more records

Use the init operation to delete the records from an existing table, then import records to the table. The following example removes the records from the table customers then imports new ones from the file marketing for those records with a postal code of 91750.

sde2tbl -o init -t customers -f marketing -T SDE -w "zip=91750" -u av

 

Home

Copyright © Environmental Systems Research Institute, Inc. 2004 - 2010.