Skip to content

Commit

Permalink
SNOW-978294 provide usage example on how to insert data into a VARIAN…
Browse files Browse the repository at this point in the history
…T column

example kindly provided by @rkdnc9
  • Loading branch information
sfc-gh-dszmolka committed Nov 29, 2023
1 parent 62f2206 commit 64b0b6b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,21 @@ using (IDbConnection conn = new SnowflakeDbConnection())
}
```

Writing to `VARIANT` column with bind variable
----------------------------------------------
You can use bind variables together with `VARIANT` datatype column. For example, to insert data:
```cs
cmd.CommandText = "insert into table (id, data) select :id, parse_json(:data)"
```
then reference the `SFDataType` for the named parameter, `p2` in this example:
```cs
p2.SFDataType = SFDataType.TEXT
```
As an alternative, you can use an approach like:
```cs
var p2 = new SnowflakeDbParameter("data", SFDataType.TEXT) { Value = jsonStr };
```

Close the Connection
--------------------

Expand Down

0 comments on commit 64b0b6b

Please sign in to comment.