SQL data types

<< Click to Display Table of Contents >>

Navigation:  Local SQL > Data Definition Language >

SQL data types

Previous pageReturn to chapter overviewNext page
hmtoggle_plus1See also

The table below lists the SQL data types available in local SQL. Table columns, literals, parameter values, and calculation results will all be of one of these types. When defining columns in CREATE TABLE and ALTER TABLE statements, the SQL data types below are translated by the BDE into specific Paradox, dBASE, and FoxPro column types. These data types are also used with the CAST function when converting a value from one data type to another (except BLOB and memo types, on which CAST cannot operate).

While there are three SQL data types available that apply to floating point numbers (DECIMAL, NUMERIC, and FLOAT), each translates to a different native column type in local tables. Further, the native column type used varies depending on the particular local table type used (Paradox, dBASE, or FoxPro).

 

Column type

Definition syntax

SMALLINT

Small integer values. No scale or precision are specified.

INTEGER

Integer values. No scale or precision are specified.

DECIMAL[(s[, p])]

Floating point numbers. Scale and precision are each optional. If precision is specified, scale must also be.

NUMERIC[(s[, p])]

Floating point numbers. Scale and precision are each optional. If precision is specified, scale must also be.

FLOAT(s, p)

Floating point numbers. Scale and precision are each optional. If precision is specified, scale must also be.

CHARACTER(length)

Alpha-numeric type values. Specify length of column capacity, in bytes. Length must be between 1 and 254.

VARCHAR(length)

Alpha-numeric type values. Specify length of column capacity, in bytes. Length must be between 1 and 254. In local SQL, VARCHAR is functionally the same as CHAR.

DATE

Date values with no time portion. No scale or precision are specified.

BOOLEAN

Logical (TRUE/FALSE) values. No scale or precision are specified.

BLOB(length, type)

Streaming text or raw binary data. Specify length (column capacity), in bytes. Specify the type of BLOB column: Memo (1), Binary (2), Formatted Memo (3), OLE (4), Graphic/Binary (5). For Paradox BLOB columns, length must be between 0 and 240 (amount of data stored in .DB file); for dBASE tables between 0 and 32,767 (valid length has no practical effect on column created). Not all BLOB column types apply to all local table types or correspond to the same native column types in all table types.

TIME

Time values, with no date portion. No scale or precision specified.

TIMESTAMP

Date and time portions in same column. No scale or precision specified.

MONEY

Floating point number values. Scale and precision is automatic.

AUTOINC

Automatically incrementing column values. No scale or precision specified.

BYTES(length)

User-defined data types. Specify length (column capacity), in bytes.