Type system and temporal representations
Scalar types, decimal precision, dates and hardware timestamps in Octaviius SQL.
Scalar families and precision
TINYINT, SMALLINT, INT and BIGINT describe integers; BIT Boolean values; DECIMAL and NUMERIC exact decimal measures; REAL and FLOAT approximate values. CHAR, NCHAR, VARCHAR, NVARCHAR and TEXT cover text, BINARY and VARBINARY binary data. Define measure precision and scale before loading to stabilize conversions and aggregation.
Available declared types
| Family | Types | Checkpoints |
|---|---|---|
| Integer | BIT, TINYINT, SMALLINT, INT, BIGINT | Choose an appropriate range; exact BIGINT is a string on typed transport. |
| Decimal | DECIMAL(p,s), NUMERIC(p,s) | Precision up to 38; scale <= precision; DECIMAL defaults to (18,0). |
| Approximate | FLOAT, REAL, DOUBLE PRECISION | Approximate calculations, not exact monetary storage. |
| Text | TEXT, CHAR(n), VARCHAR(n), NCHAR(n), NVARCHAR(n) | Unicode; length/conversion semantics do not reproduce all SQL Server collations. |
| Binary | BINARY(n), VARBINARY(n) | Prepared parameters use hex; storage contains bytes. |
| Temporal | DATE, TIME, DATETIME, DATETIME2, DATETIMEOFFSET | Prefer ISO 8601; at most microseconds. |
| Integer timestamp | TIMESTAMP UNIT ms / s / us | Numeric extension, not SQL Server rowversion. |
INTEGER aliases INT; CHARACTER and CHARACTER VARYING map to recognized character variants. NOT NULL is explicit, otherwise columns are nullable. Discover actual client types/arguments with columns_meta or sys.sp_catalog.
CAST, rounding and strings
CAST(expression AS type) and CONVERT(type, expression[, style]) perform SQL conversion. DECIMAL quantizes to declared scale using HALF_UP; excess precision is rejected. A text CAST without length defaults to 30; a text variable declaration without length defaults to 1. Explicitly declare needed lengths. NULL and empty strings differ.
SELECT CAST('12.34567' AS DECIMAL(19,4)) AS montant,
CAST('2026-01-02' AS DATE) AS jour,
CONVERT(VARCHAR(10), CAST('2026-01-02' AS DATE), 23) AS iso;Actual time precision and CONVERT styles
More than six fractional digits are not retained. DATEPART weekday/week uses default DATEFIRST 7; DATENAME returns English names; SET LANGUAGE and SET DATEFIRST are absent. DATEADD nanosecond rejects amounts not divisible by 1000. DATETIMEOFFSET preserves an offset, not a timezone-rule database.
Temporal CONVERT styles: 0/100, 101..108, 110..112, 114, 120, 121, 126, 127, 23 and short-year forms 1..8, 10..12. 23 is YYYY-MM-DD; 112 is YYYYMMDD; 120 uses a date/time space; 126/127 are ISO. Other styles are rejected; fractional formatting does not promise bit-identical SQL Server compatibility.