Incomplete large json string from SQL DB

6 ビュー (過去 30 日間)
Pete sherer
Pete sherer 2024 年 3 月 24 日
回答済み: Abhaya 2024 年 8 月 16 日
Hi,
I have a large json string stored in SQL DB. table in SQL has 2 fields [ ID BIGINT, jsonFld NVARCHAR(MAX)]
If i used below command, I only get partial string back from SQL.
tSQL='SELECT ID, jsonFld FROM DBtable WHERE ID=1';
ttxt = connDB.fetch( tSQL);
If I used below, I can retrieve more text but still not complete.
tSQL='SELECT ID, jsonFld= CAST( jsonFld AS TEXT) FROM DBtable WHERE ID=1';
ttxt = connDB.fetch( tSQL); % The length( ttxt.jsonFld) is 9999999.
any suggestion on what I can do to receive full NVARCHAR(MAX) string back from SQL?
Thanks,

回答 (1 件)

Abhaya
Abhaya 2024 年 8 月 16 日
Follow the steps given below, to retrieve full string of the field named ‘jsonfid’ with ‘NVARCHAR(MAX)’ datatype from a SQL db.
  • Change the driver of the MATLAB 'Database toolbox' to JDBC driver, from ODBC driver.
  • Change the datatype of the field ‘jsonfid’ in ‘SQL’ table from ‘NVARCHAR(MAX)’ to ‘TEXT’.
You can refer to the following MATLAB Answers community question for further explanation.
Hope this helps.

カテゴリ

Help Center および File ExchangeJSON Format についてさらに検索

タグ

製品


リリース

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by