Previous Page | Next Page

SAS/ACCESS Interface to Netezza

Data Types for Netezza


Overview

Every column in a table has a name and a data type. The data type tells Netezza how much physical storage to set aside for the column and the form in which the data is stored. This section includes information about Netezza data types, null and default values, and data conversions.

For more information about Netezza data types and to determine which data types are available for your version of Netezza, see your Netezza Database User's Guide.

SAS/ACCESS Interface to Netezza does not directly support TIMETZ or INTERVAL types. Any columns using these types are read into SAS as character strings.


String Data

CHAR(n), NCHAR(n)

specifies a fixed-length column for character string data. The maximum length is 32,768 characters. NCHAR data is stored as UTF-8 in the Netezza database.

VARCHAR(n), NVARCHAR(n)

specifies a varying-length column for character string data. The maximum length is 32,768 characters. NVARCHAR data is stored as UTF-8 in the Netezza database.


Numeric Data

BIGINT

specifies a big integer. Values in a column of this type can range from -9223372036854775808 to +9223372036854775807.

SMALLINT

specifies a small integer. Values in a column of this type can range from -32768 through +32767.

INTEGER

specifies a large integer. Values in a column of this type can range from -2147483648 through +2147483647.

BYTEINT

specifies a tiny integer. Values in a column of this type can range from -128 to +127.

DOUBLE | DOUBLE PRECISION

specifies a floating-point number that is 64 bits long. Values in a column of this type can range from -1.79769E+308 to -2.225E-307 or +2.225E-307 to +1.79769E+308, or they can be 0. This data type is stored the same way that SAS stores its numeric data type. Therefore, numeric columns of this type require the least processing when SAS accesses them.

REAL

specifies a floating-point number that is 32 bits long. Values in a column of this type can range from approximately -3.4E38 to -1.17E-38 and +1.17E-38 to +3.4E38.

DECIMAL | DEC | NUMERIC | NUM

specifies a fixed-point decimal number. The precision and scale of the number determines the position of the decimal point. The numbers to the right of the decimal point are the scale, and the scale cannot be negative or greater than the precision. The maximum precision is 38 digits.


Date, Time, and Timestamp Data

SQL date and time data types are collectively called datetime values. The SQL data types for dates, times, and timestamps are listed here. Be aware that columns of these data types can contain data values that are out of range for SAS.

DATE

specifies date values. The range is 01-01-0001 to 12-31-9999. The default format YYYY-MM-DD--for example, 1961-06-13. Netezza supports many other formats for entering date data. For more information, see your Netezza Database User's Guide.

TIME

specifies time values in hours, minutes, and seconds to six decimal positions: hh:mm:ss[.nnnnnn]. The range is 00:00:00.000000 to 23:59:59.999999. However, due to the ODBC-style interface that SAS/ACCESS Interface to Netezza uses to communicate with the Netezza Performance Server, any fractional seconds are lost in the transfer of data from server to client.

TIMESTAMP

combines a date and time in the default format of yyyy-mm-dd hh:mm:ss[.nnnnnn]. For example, a timestamp for precisely 2:25 p.m. on January 25, 1991, would be 1991-01-25-14.25.00.000000. Values in a column of this type have the same ranges as described for DATE and TIME.


Netezza Null Values

Netezza has a special value called NULL. A Netezza NULL value means an absence of information and is analogous to a SAS missing value. When SAS/ACCESS reads a Netezza NULL value, it interprets it as a SAS missing value.

You can define a column in a Netezza table so that it requires data. To do this in SQL, you specify a column as NOT NULL, which tells SQL to allow only a row to be added to a table if a value exists for the field. For example, NOT NULL assigned to the CUSTOMER field in the SASDEMO.CUSTOMER table does not allow a row to be added unless there is a value for CUSTOMER. When creating a Netezza table with SAS/ACCESS, you can use the DBNULL= data set option to indicate whether NULL is a valid value for specified columns.

You can also define Netezza columns as NOT NULL DEFAULT. For more information about using the NOT NULL DEFAULT value, see your Netezza Database User's Guide.

Knowing whether a Netezza column allows NULLs or whether the host system supplies a default value for a column that is defined as NOT NULL DEFAULT can help you write selection criteria and enter values to update a table. Unless a column is defined as NOT NULL or NOT NULL DEFAULT, it allows NULL values.

For more information about how SAS handles NULL values, see Potential Result Set Differences When Processing Null Data.

To control how SAS missing character values are handled by the DBMS, use the NULLCHAR= and NULLCHARVAL= data set options.


LIBNAME Statement Data Conversions

This table shows the default formats that SAS/ACCESS Interface to Netezza assigns to SAS variables when using the LIBNAME statement to read from a Netezza table. These default formats are based on Netezza column attributes.

LIBNAME Statement: Default SAS Formats for Netezza Data Types
Netezza Data Type SAS Data Type Default SAS Format
CHAR(n)* character $n.
VARCHAR(n)* character $n.
INTEGER numeric 11.
SMALLINT

BYTEINT

numeric

numeric

6.

4.

BIGINT numeric 20.
DECIMAL(p,s) numeric m.n
NUMERIC(p,s) numeric m.n
REAL numeric none
DOUBLE numeric none
TIME numeric TIME8.
DATE numeric DATE9.
TIMESTAMP numeric DATETIME25.6
* n in Netezza data types is equivalent to w in SAS formats.

The following table shows the default Netezza data types that SAS/ACCESS assigns to SAS variable formats during output operations when you use the LIBNAME statement.

LIBNAME Statement: Default Netezza Data Types for SAS Variable Formats
SAS Variable Format Netezza Data Type
m.n DECIMAL(p,s)
other numerics DOUBLE
$n. VARCHAR(n)*
datetime formats TIMESTAMP
date formats DATE
time formats TIME
* n in Netezza data types is equivalent to w in SAS formats.

Previous Page | Next Page | Top of Page