MS SQL Server type mapping
The tables below list every MS SQL Server column type (Transact-SQL Data types) and the Kotlin type produced when the column is read into a DataFrame. Aliases are canonicalized by SQL Server at CREATE TABLE time, so DataFrame only ever sees the canonical type; they are listed in the same row as the canonical type for reference.
API reference: MsSql
Column nullability is determined from the metadata provided by the JDBC driver. If the driver does not explicitly report a column as non-nullable, it is mapped to a nullable Kotlin type (Int? instead of Int).
Exact numeric types
Canonical | Aliases | DataFrame column type | Notes |
|---|---|---|---|
| none |
| Single-bit integer ( |
| none |
| 1-byte unsigned integer ( |
| none |
| 2-byte signed integer. The driver returns |
|
|
| 4-byte signed integer. |
| none |
| 8-byte signed integer. |
|
|
| Fixed-point. |
| none |
| 4-byte fixed-point money ( |
| none |
| 8-byte fixed-point money. |
Approximate numeric types
Canonical | Aliases | DataFrame column type | Notes |
|---|---|---|---|
|
|
| Default |
| (alias) |
| Explicit 4-byte float; equivalent to |
Date and time types
Canonical | Aliases | DataFrame column type | Notes |
|---|---|---|---|
| none |
| Date only ( |
| none |
| Time only with fractional-second precision (0–7). |
| none |
| Date + minute-precision time. |
| none |
| Legacy date + time; ~3.33 ms precision. |
| none |
| Modern date + time with fractional-second precision (0–7). |
| none |
| Date + time + explicit UTC offset. |
Character strings
Canonical | Aliases | DataFrame column type | Notes |
|---|---|---|---|
|
|
| Fixed-length non-Unicode text (max |
|
|
| Variable-length non-Unicode text. |
| none |
| Deprecated — use |
|
|
| Fixed-length UTF-16 text (max |
|
|
| Variable-length UTF-16 text. |
|
|
| Deprecated — use |
Binary strings
Canonical | Aliases | DataFrame column type | Notes |
|---|---|---|---|
| none |
| Fixed-length binary (max |
|
|
| Variable-length binary. |
| none |
| Deprecated — use |
Row-version and identity
Canonical | Aliases | DataFrame column type | Notes |
|---|---|---|---|
|
|
| 8-byte row-version. Note: SQL Server's |
| none |
| 16-byte GUID, read as its 36-character string form. |
Other types
Canonical | Aliases | DataFrame column type | Notes |
|---|---|---|---|
| none |
| XML document text. |
| none |
| Column holds a value of any base type; driver returns as generic |
| none |
| Hierarchical position (raw binary). |
| none |
| Planar spatial (WKB / EWKB). |
| none |
| Geodetic spatial (WKB / EWKB). |
MS SQL Server specifics
Unlike most databases, SQL Server's
tinyintis unsigned (0..255), not signed.The keyword
TIMESTAMPin T-SQL is a synonym forrowversion(a row-version stamp), not a date/time type. Usedatetime2for wall-clock timestamps.text,ntext, andimageare deprecated; SQL Server documentation recommendsvarchar(max)/nvarchar(max)/varbinary(max)respectively.float(n)withn <= 24returnsFloat;n >= 25returnsDouble.floatalone meansfloat(53)and returnsDouble.realisfloat(24)and returnsFloat.
Unsupported types
geometry,geography; read as raw WKBByteArray.hierarchyid; read as rawByteArray.sql_variant; read as genericAny.cursorandtabletypes cannot be columns; they only occur as procedure parameters.