If you’re getting SQL Server error 13680 that reads something like “Column ‘details’ on table ‘table_name’ is not of JSON data type, which is required to create a JSON index on it.” it looks like you’re trying to create a JSON index on a non-JSON column. You can only create JSON indexes on columns defined with the JSON type.
To fix this issue, be sure that the column is of JSON type before running CREATE JSON INDEX on it.
Example of Error
Suppose we create a table like this:
CREATE TABLE support_tickets (
ticket_id INT NOT NULL PRIMARY KEY,
details VARCHAR(MAX) NOT NULL
);
The details column uses a VARCHAR(MAX) type. This is what we might’ve done to store JSON before SQL Server 2025 came along with the JSON data type.
SQL Server 2025 also introduced the CREATE JSON INDEX statement, which allows us to create an index on JSON columns. Here’s what happens if we try to create a JSON index on the details column:
CREATE JSON INDEX ix_tickets_details
ON support_tickets (details);
Result:
Msg 13680, Level 16, State 1, Line 1
Column 'details' on table 'support_tickets' is not of JSON data type, which is required to create a JSON index on it.
We get the error.
Solution
As mentioned, we can only create a JSON index on columns of the JSON data type. Therefore, we’ll either need to change our CREATE TABLE statement before creating the table, or use an ALTER TABLE statement to change the existing table.
Option 1: Change the CREATE TABLE Statement:
CREATE TABLE support_tickets (
ticket_id INT NOT NULL PRIMARY KEY,
details JSON NOT NULL
);
The only difference is that the details column is defined as JSON instead of VARCHAR(MAX).
This allows us to create a JSON index on that column:
CREATE JSON INDEX ix_tickets_details
ON support_tickets (details);
Result:
Commands completed successfully.
This time it worked without error.
Option 2: Alter the Existing Column
If the table already exists, you can alter the column without creating the table all over again:
ALTER TABLE support_tickets
ALTER COLUMN details JSON NOT NULL;
Now we can go ahead and create the JSON index:
CREATE JSON INDEX ix_tickets_details
ON support_tickets (details);
Output:
Commands completed successfully.
It worked as expected.
I should point out that this option only works if the existing data (if any) is valid JSON. If the column contains data that can’t be validated as valid JSON, you’ll get an error like this:
Msg 13609, Level 16, State 9, Line 1
JSON text is not properly formatted. Unexpected character 'H' is found at position 0.
The statement has been terminated.
In this case, you’ll need to review the data and see if it can be modified into a JSON format. If not, then you’ll need to rethink why you’re trying to create a JSON index on a column that doesn’t even contain JSON data. Maybe creating a regular index would be more suitable.