0

Im simply trying to insert json data into a dynamic column.

Data looks like follows:

"{"Fields": {
    "CompanyCode": "1",
    "FiscalYear": "2014",
    "CalYear": "2014",
    "CalPeriod": "1",
    "MinPostDate": "2014-01-14T00:00:00",
    "MaxPostDate": "2014-01-14T00:00:00",
    "CreditDebitInd": "H"
  }
}"

Query is like this:

 INSERT INTO jsontest (ID, Text) VALUES(DEFAULT, 'JsonHere');

ID is an ID which is the PK and it auto increments. Text is a BLOB

8
  • For INSERT, REPLACE, and UPDATE, if a generated column is inserted into, replaced, or updated explicitly, the only permitted value is DEFAULT.. See 13.1.18 CREATE TABLE Syntax :: CREATE TABLE and Generated Columns. Commented Mar 18, 2016 at 13:27
  • @wchiquito This literally has nothing to do with my question Commented Mar 18, 2016 at 14:14
  • When you talk about "dynamic column", you mean generated column? Otherwise, please add the structure of your table. Commented Mar 18, 2016 at 14:23
  • When I talk about a dynamic column, Im talking about a blob. I will update my question with the table structure now Commented Mar 18, 2016 at 14:24
  • What version of MySQL uses? Do you know 11.6 The JSON Data Type?, it can be useful. Commented Mar 18, 2016 at 14:30

1 Answer 1

2
INSERT INTO test VALUES(DEFAULT, '{"Fields": {
    "CompanyCode": "E009",
    "FiscalYear": "2014",
    "CalYear": "2014",
    "CalPeriod": "1",
    "MinPostDate": "2014-01-14T00:00:00",
    "MaxPostDate": "2014-01-14T00:00:00",
    "CreditDebitInd": "H"
  }
}');

I was using the ` symbol to encapsulate the data. It needs to be the ' symbol

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.