Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

JSON type parameters status (and JSON feature in general) #3136

Unanswered
MaceWindu asked this question in Q&A
Discussion options

I wonder what is the current status for parameters with SqlDbType.Json set.

I've tested both Azure SQL Db (highest available compat level 170) and Azure SQL Managed Instance (with Always-up-to-date update policy) and see following behavior:

Parameter \ Database Azure SQL DB Azure Managed Instance
string ✔️ ✔️
string + SqlDbType.Json The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 3 ("@p1"): JSON data type is not supported in TDS on the server side. RPC was aborted without execution. The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. The RPC name is invalid.
SqlJson The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 3 ("@p1"): JSON data type is not supported in TDS on the server side. RPC was aborted without execution. The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. The RPC name is invalid.
SqlJson + SqlDbType.Json The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 3 ("@p1"): JSON data type is not supported in TDS on the server side. RPC was aborted without execution. The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. The RPC name is invalid.
JsonDocument No mapping exists from object type System.Text.Json.JsonDocument to a known managed provider native type. Failed to convert parameter value from a JsonDocument to a String.
JsonDocument + SqlDbType.Json Failed to convert parameter value from a JsonDocument to a String. No mapping exists from object type System.Text.Json.JsonDocument to a known managed provider native type.

Looks like the only way to pass JSON to server is to use literal or string-typed parameter. type 35 (SqlJson) is not handled by server and JsonDocument despite different code pathes on client - fails on both.

Also looking at #2622 I observe that nor GetFieldValue<byte[]> nor GetStream APIs supported. Would be nice to have a document that describes actual funtionality for new type:

  • how to write json value to database using parameters and bulk copy: supported types and required configuration
  • how to read value from data reader: supported types and APIs
You must be logged in to vote

Replies: 2 comments

Comment options

Looks like discussion in #2665 contains some details on lack of JsonDocument support and Stream support

You must be logged in to vote
0 replies
Comment options

Hi @MaceWindu, we'll discuss internally and get back to you with the documentation plan as JSON rolls out. Thanks!

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /