lai
August 17, 2018, 11:17am
1
Using the latest ServiceStack.Ormlite.SqlServer 5.1.1 from myget, I’m getting the error message
Cannot find data type json
When attempting run db.CreateTableIfNotExists();
The class that I’m trying create has the following property
[CustomField("json")]
public StandardImportModel StandardInvoiceImport { get; set; }
This has worked fine in the past. Do you have any idea what might be causing the issue?
mythz
August 17, 2018, 12:07pm
2
You can either enable a debug logger or register a BeforeExecFilter to print out the generated SQL:
OrmLiteConfig.BeforeExecFilter = dbCmd => Console.WriteLine(dbCmd.GetDebugString());
Then run the generated SQL in SQL Server to see the Error Response from SQL Server directly. But the error message says the DB you’re trying to run it on doesn’t have the json data type.
lai
August 17, 2018, 1:00pm
3
This is the error message,
Column, parameter, or variable #7: Cannot find data type json.
the statement for creating the column is
"StandardInvoiceImport" json NULL,
The library use to create the column with the datatype varchar(max)
mythz
August 17, 2018, 1:04pm
4
This is what you’ve told OrmLite to change the data type to, which SQL Server says it doesn’t support.
lai
August 17, 2018, 1:33pm
5
Ok must of been an update on sqlserver on my machine which I wasn’t aware of as I’m sure this worked last week.
What is the correct way to tell sqlserver to create json blob column when using db.CreateTableIfNotExists?
mythz
August 17, 2018, 1:37pm
6
Look at what the SQL Server column definition is for your SQL Server version and use that. There’s no SQL Standard JSON data type nor is it a data type OrmLite supports.