SAP HANA Data Types: Numeric, Character String, Decimal
โก Smart Summary
SAP HANA Data Types define what each column may store, covering date time, numeric, boolean, character string, binary, large object, and multi-valued classifications, each mapping to a specific column store type.

In this SAP HANA Data Types tutorial, we will learn:
1) SAP HANA Data Types – SAP HANA data types include Date Times, Numeric data type, Boolean, Character String, Binary data types, etc.
2) SAP HANA Identifiers – Delimited Identifiers and Undelimited Identifiers
Data Types in SAP HANA
In SAP HANA Database, SQL Data Types are as below:
| Classification | Sub-Classification | SQL Data Type | Column Store Type | Default Format |
|---|---|---|---|---|
| Date Times Types | Date | DATE | CS_DAYDATE | ‘YYYY-MM-DD’ |
| Time | TIME | CS_SECONDTIME | ‘HH24:MI:SS’ | |
| Second Date | SECONDDATE | CS_LONGDATE | ‘YYYY-MM-DD HH24:MI:SS’ | |
| Time Stamp | TIMESTAMP | CS_SECONDDATE | ‘YYYY-MM-DD HH24:MI:SS.FFn’ | |
| Numeric Types | Tiny Integer | TINYINT | CS_INT | 8-bit unsigned integer, Range 0 To 255 |
| Small Integer | SMALLINT | CS_INT | 16-bit signed integer, Range -32,768 To 32,767 | |
| Integer | INTEGER | CS_INT | 32-bit signed integer, Range -2,147,483,648 To 2,147,483,647 | |
| Big Integer | BIGINT | CS_FIXED(18,0) | 64-bit signed integer, Range -9,223,372,036,854,775,808 To 9,223,372,036,854,775,807 | |
| Decimal | DECIMAL(p,s) p-Precision s- scale |
CS_FIXED(p-s,s) | Precision p can range from 1 to 38. The scale s can range from 0 to p for SAP HANA decimal data type. If precision and scale are not specified, DECIMAL becomes a floating-point decimal number. |
|
| Small Decimal | SMALLDECIMAL | CS_SDFLOAT | It is a floating-point decimal number. The precision and scale should be within the range 1~16 for precision and -369~368 for scale, depending on the stored value. SMALLDECIMAL is only supported for column store Table. | |
| Real Number | REAL | CS_FLOAT | single-precision 32-bit floating-point number | |
| Double Number | DOUBLE | CS_DOUBLE | a double-precision 64-bit floating-point number | |
| Float | FLOAT(n) | CS_DOUBLE | It is 32-bit or 64-bit real number. Where n specifies the number of bits and should be in the range between 1 and 53. | |
| Boolean | Boolean | BOOLEAN | CS_INT | TRUE, FALSE And UNKNOWN (NULL). |
| Character String | Variable-Length Character String | VARCHAR(n) | CS_STRING | This HANA string length data type is a Variable-length character string, where ‘n’ specified the maximum length in bytes and this is an integer between 1 and 5000. |
| Variable-Length Unicode character | NVARCHAR(n) | CS_STRING | Variable-length Unicode character set string, where <n> indicates the maximum length in characters and is an integer between 1 and 5000 | |
| Alpha Numeric Character | ALPHANUM(n) | CS_ALPHANUM | Variable length alpha-numeric characters, where n indicates the maximum length and is an integer between 1 and 127 | |
| Short Text | SHORTTEXT(n) | CS_STRING | It is Variable-length character string which provide text search and string search features. This data type can be defined for column store tables, but not for row tables. | |
| Binary Types | Binary Text | VARBINARY(n) | CS_RAW | Store binary data of a specified maximum length in bytes, where n indicates the maximum length and is an integer between 1 and 5000. |
| LOB Types(Large Object Types) | Binary LOB | BLOB | CS_RAW | Large amounts of binary data |
| Character LOB | CLOB | CS_STRING | ASCII character data | |
| Unicode Character LOB | NCLOB | CS_STRING | Large Unicode character object | |
| TEXT | TEXT | CS_STRING | The TEXT data type provide text search features. This data type can be defined for column Store tables, but not for row store tables. | |
| BINARY Text Data | BINTEXT | CS_STRING | The BINTEXT data type is similar to data type TEXT and thus supports text search features, but it is possible to insert binary data. This data type can be defined for column tables, but not for row tables. | |
| Multi-valued Types | Array | ARRAY | It stores collections of values of the same data type where each element is related with exactly one position. Arrays can contain NULL values as in the absence of a value. |
Choosing the Right SAP HANA Data Type
The table above lists what is available. Choosing well matters more in SAP HANA than in a disk based database, because every column lives in memory and an oversized type consumes a scarce resource on every row.
Four rules cover most decisions:
- Take the smallest numeric type that fits. A status flag with five possible values needs TINYINT, not INTEGER. Across a billion row table the difference is measured in gigabytes of memory.
- Never store money in REAL or DOUBLE. Floating point cannot represent decimal fractions exactly, so totals drift by fractions of a currency unit. Use DECIMAL with an explicit precision and scale.
- Prefer NVARCHAR to VARCHAR. VARCHAR counts bytes and NVARCHAR counts characters, so any non ASCII text truncates unexpectedly in VARCHAR. Modern SAP HANA releases treat VARCHAR as NVARCHAR for exactly this reason.
- Match date precision to the requirement. DATE for a calendar day, SECONDDATE where the time of day matters, and TIMESTAMP only where sub second precision is genuinely used. Each step up costs storage on every row.
Large object types deserve particular caution. A BLOB or NCLOB column is convenient but heavy, and text search on TEXT or SHORTTEXT works only on column store tables, so the storage choice and the data type choice are linked. Storage options are covered in the SAP HANA SQL tutorial.
SAP HANA Identifiers
Identifiers are used to represent name in SQL statement (e.g. table name, view name, column name, index name, synonym name, procedure name, function name, etc.)
There are two types of identifiers in SAP HANA: Delimited identifiers and Undelimited identifiers.
- Delimited Identifiers โ It is enclosed in the delimiter, Double Quotes “”. The identifier can contain any character including special character.
- Undelimited Identifiers โ Undelimited identifiers (table name, column name) must start with a letter and cannot contain any symbols other than a digit or an underscore ‘_’.
There are two types Quotation mark for delimit as below-
- Single Quotation Mark (‘ ‘) โ It is used to delimit the string.
- Double Quotation Mark (” “)– It is used for delimiting identifiers.
โ ๏ธ Warning: An undelimited identifier is converted to upper case when the object is created. Creating a table as employee and later selecting from “employee” in lower case fails, because the stored name is EMPLOYEE. Either avoid double quotes entirely, or use them consistently.
Data Type Conversion and Common Errors
SAP HANA converts between compatible types automatically, but implicit conversion is the quiet source of wrong results and slow queries. Explicit conversion makes the intention visible.
Two functions do the work. CAST converts a value to a named type, and TO_DATE, TO_VARCHAR, TO_DECIMAL and their relatives convert with an optional format string.
-- Explicit conversion with CAST SELECT CAST('1234' AS INTEGER) FROM DUMMY; -- Conversion with an explicit format SELECT TO_DATE('2026-07-21', 'YYYY-MM-DD') FROM DUMMY; -- Number to string with fixed decimals SELECT TO_DECIMAL(1234.5678, 10, 2) FROM DUMMY;
Four errors account for most conversion problems:
- Numeric overflow. Inserting 40000 into a SMALLINT fails because the signed range stops at 32,767. The message names the column rather than the value, so check the definition first.
- String truncation. Loading text longer than the declared length raises an error rather than silently cutting it. Count characters against NVARCHAR and bytes against VARCHAR.
- Invalid date format. Passing a string in the wrong pattern to TO_DATE fails. Always supply the format mask instead of relying on the session default.
- Implicit conversion in a WHERE clause. Comparing a character column against a number forces a conversion on every row, which prevents efficient filtering. Convert the constant instead of the column.
The comparison symbols used in these filters are covered in SAP HANA operators, and the wider platform in the SAP HANA tutorial series.
