-
Notifications
You must be signed in to change notification settings - Fork 151
Closed
Labels
questionIssue is a usage/other question rather than a bugIssue is a usage/other question rather than a bug
Description
I am using snowflake named parameters but it is failing with error below. I have tried different sensible DbType options but it won't work.
Error: SQL compilation error:
Expression type does not match column data type, expecting VARIANT but got VARCHAR(1301) for column MESSAGE SqlState: 22000,
C# Part
var cmd = conn.CreateCommand();
cmd.CommandText = "insert into tbl (kafka_key, message) values (:kafkaKey, :message)";
var p1 = cmd.CreateParameter();
p1.ParameterName = "kafkaKey";
p1.DbType = DbType.String;
p1.Value = szKey;
var p2 = cmd.CreateParameter() as SnowflakeDbParameter;
p2.ParameterName = "message";
p2.DbType = DbType.String;
//p2.SFDataType = SFDataType.VARIANT; this fails too.
p2.Value = jsonMessage;
cmd.Parameters.Add(p1);
cmd.Parameters.Add(p2);
var result = await cmd.ExecuteNonQueryAsync();
Create Table
create OR REPLACE TABLE tbl (
kafka_key varchar(36),
message variant);
Metadata
Metadata
Assignees
Labels
questionIssue is a usage/other question rather than a bugIssue is a usage/other question rather than a bug