On this page
The table below contains type mapping rules that are used to map Snowflake field types to .NET types.
Provider Data Type displays the corresponding SnowflakeType enumeration value. .NET Data Type displays the type returned by GetFieldType() and GetValue(). Synonyms of Snowflake data types, for example, INT or VARCHAR, are mapped in the same way as the types they are synonyms for.
Snowflake Native Data Type |
Provider Data Type |
.NET Data Type |
| NUMBER with scale 0 (INT, INTEGER, BIGINT, SMALLINT, TINYINT, BYTEINT) | Integer | Int64 |
| NUMBER with scale greater than 0 (DECIMAL, NUMERIC) | Decimal | Decimal |
| FLOAT (FLOAT4, FLOAT8, DOUBLE, DOUBLE PRECISION, REAL) | Double | Double |
| VARCHAR (STRING, TEXT, CHAR, CHARACTER, NCHAR, NVARCHAR) | String | String |
| VARCHAR(36) when Text36AsGuid=true, VARCHAR(38) when Text38AsGuid=true | Guid | Guid |
| BINARY (VARBINARY) | Binary | Byte[] |
| BOOLEAN | Boolean | Boolean |
| DATE | Date | DateTime |
| TIME | Time | TimeSpan |
| TIMESTAMP_NTZ (DATETIME) | DateTime | DateTime |
| TIMESTAMP_LTZ | TimestampLTZ | DateTime |
| TIMESTAMP_TZ | TimestampTZ | DateTimeOffset |
| VARIANT | Variant | String |
| OBJECT | Object | String |
| ARRAY | Array | String |
| GEOGRAPHY, GEOMETRY | Geography | String |
| VECTOR | Array | String (JSON array) |
The Text36AsGuid and Text38AsGuid connection string parameters are disabled by default. When you enable them, VARCHAR(36) and VARCHAR(38) columns are returned as Guid values. Use these parameters if your tables store GUIDs as text of 36 or 38 characters.
A Snowflake data type that the provider does not recognize, for example, a type added to the server later, is read as String.
Semi-Structured, Spatial, and Vector Data
Values of VARIANT, OBJECT, and ARRAY columns are returned as String values that contain JSON text in the format Snowflake returns it: objects and arrays are indented and span several lines. A value extracted by a path, such as payload:name, is JSON as well, so a string value comes in double quotes; cast it with ::STRING to get the plain text. VECTOR values are returned as JSON arrays in the format Snowflake returns them: the elements of a FLOAT vector have six decimal places, for example, [1.500000,2.000000,3.000000], and the elements of an INT vector are integers, for example, [1,2,3]. For details and examples, see Working with Semi-Structured Data.
Snowflake doesn't accept parameters of the Variant, Object, and Array types. A statement with such a parameter fails with an error such as "Unsupported data type 'VARIANT'". A String parameter can't be inserted into a VARIANT, OBJECT, or ARRAY column directly either, because Snowflake doesn't convert text to these types. Such a statement fails with the "Expression type does not match column data type, expecting VARIANT but got VARCHAR" error. To write semi-structured data, pass the JSON text in a String parameter and convert it with the PARSE_JSON function. Because Snowflake doesn't allow PARSE_JSON in the VALUES clause, use INSERT ... SELECT:
|
|---|
INSERT INTO events (id, payload) SELECT :id, PARSE_JSON(:payload) |
GEOGRAPHY and GEOMETRY values are returned as text in the format set by the GEOGRAPHY_OUTPUT_FORMAT and GEOMETRY_OUTPUT_FORMAT session parameters (GeoJSON by default). To write them, pass the value as text, for example, in the WKT or GeoJSON format: parameters of the Geography type are sent to Snowflake as text.
Date and Time Values
The UTC Dates connection string parameter determines how DateTime values are converted:
- By default, UTC Dates is false, and dotConnect for Snowflake treats DateTime values of your application as local time. DateTime parameter values of the Unspecified and Local kinds are converted from local time to UTC before they are sent, and TIMESTAMP_NTZ and TIMESTAMP_LTZ values are converted from UTC to local time when they are read. Values that you write and read with dotConnect for Snowflake are the same, but the values stored in TIMESTAMP_NTZ columns differ from them by the time zone offset of the computer where the application runs. The same applies to the results of date and time calculations and comparisons performed in Snowflake, and to the values that other applications write and read.
- If you set UTC Dates to true, DateTime parameter values of the Unspecified and Utc kinds are sent as is, TIMESTAMP_NTZ values are returned as they are stored, and TIMESTAMP_LTZ values are returned in UTC. Use this mode if other applications work with the same data or if you compare and calculate dates in SQL.
Note the following as well:
- DATE and TIME values are not converted. To write values to DATE columns, use parameters of the Date type (DbType.Date): with the DateTime type, the value is converted as described above, and the date can change.
- By default, a DateTime parameter is sent as a TIMESTAMP_NTZ value. When you write this value to a TIMESTAMP_LTZ or TIMESTAMP_TZ column, Snowflake interprets it in the session time zone, while dotConnect for Snowflake by default sends the UTC time (see above). As a result, the stored point in time is shifted by the UTC offset of the session time zone. To write DateTime values to these columns, set the Type property of the parameter to TimestampLTZ or TimestampTZ. In this case, a DateTime value of the Utc kind is interpreted as UTC, and a value of the Local kind as the local time of the client computer. A value of the Unspecified kind is interpreted as the local time of the client computer, except for TimestampLTZ with UTC Dates set to true: then it is interpreted as UTC. To store a point in time with a specific offset in a TIMESTAMP_TZ column, use a DateTimeOffset value.
- By default, a DateTimeOffset parameter is sent as a TIMESTAMP_TZ value. Snowflake doesn't implicitly convert this value when writing it to a TIMESTAMP_NTZ or TIMESTAMP_LTZ column. Instead, the statement fails with the "Expression type does not match column data type" error.
- To write a DateTimeOffset value to a TIMESTAMP_LTZ column, set the Type property of the parameter to TimestampLTZ or cast the parameter in the SQL statement, for example,
:value::TIMESTAMP_LTZ.
- To write a DateTimeOffset value to a TIMESTAMP_NTZ column, cast the parameter to TIMESTAMP_NTZ. The time zone offset is discarded, and the date and time of the value are stored as they are, for example, 13:45 for 13:45 +02:00.
- The GetDateTimeOffset method returns TIMESTAMP_LTZ and TIMESTAMP_TZ values with the UTC offset of the client computer, or with the zero offset if UTC Dates is true. The session time zone doesn't affect the returned values.
- The GetValue method returns TIMESTAMP_TZ values as DateTimeOffset values with the offset stored in Snowflake if this offset is a whole number of hours. For other offsets, the point in time is correct, but the offset is truncated to whole hours: for example, 2026-11-25 13:45:30 +05:30 is returned as 2026-11-25 13:15:30 +05:00. To get the stored offset, convert the value to text in the query, for example, with TO_VARCHAR.
- Fractional seconds of TIME and TIMESTAMP values can be returned with a lower precision than stored in Snowflake.
Other Notes
- Empty strings and empty binary values are read as DBNull. When you write an empty string or an empty byte array, Snowflake stores an empty value, not NULL.
- A NUMBER column with the scale 0 is read as Int64: a value outside the Int64 range, for example, 9223372036854775808, throws OverflowException. A NUMBER value outside the Decimal range throws OverflowException too. Fractional digits beyond the precision of the Decimal type (28–29 significant digits) are rounded. To get such values exactly, convert them to text in the query, for example, with the TO_VARCHAR function.