14,958
edits
| Line 48: | Line 48: | ||
* 將 Excel 檔案上傳到 [https://workspace.google.com/intl/zh-TW/products/sheets/ Google Sheets],再下載為 CSV 檔案。Google Sheets 匯出的 CSV 檔案會是 UTF-8 編碼,可避免亂碼問題。 | * 將 Excel 檔案上傳到 [https://workspace.google.com/intl/zh-TW/products/sheets/ Google Sheets],再下載為 CSV 檔案。Google Sheets 匯出的 CSV 檔案會是 UTF-8 編碼,可避免亂碼問題。 | ||
* 使用新版 Excel(例如 Office 365),在另存檔案時選擇「CSV UTF-8 (逗號分隔) (.csv)」選項。 | * 使用新版 Excel(例如 Office 365),在另存檔案時選擇「CSV UTF-8 (逗號分隔) (.csv)」選項。 | ||
=== 解決從資料庫匯出資料到 Excel 檔案時,出現 Support 32767 characters in a cell only 錯誤訊息 === | |||
'''問題描述''' | |||
從資料庫匯出資料到 Excel 檔案時,出現 [ERR] Support 32767 characters in a cell only 錯誤訊息。 | |||
'''根本原因''' | |||
Excel 儲存格可容納的字元數量上限為 32,767 個字元 <ref>[https://support.microsoft.com/zh-tw/office/excel-%E7%9A%84%E8%A6%8F%E6%A0%BC%E5%8F%8A%E9%99%90%E5%88%B6-1672b34d-7043-467e-8e27-269d656771c3 Excel 的規格及限制 - Microsoft 支援服務]</ref>。當資料庫中某筆資料的欄位內容超過此限制時,就會產生 [ERR] Support 32767 characters in a cell only 錯誤訊息。 | |||
'''解決方法''' | |||
可透過以下兩種方式解決<ref>[https://errerrors.blogspot.com/2023/07/fix-the-error-support-32767-characters-in-a-cell-only-on-navicat.html 解決 Navicat 匯出 Excel 檔案遇到 [ERR] Support 32767 characters in a cell only 錯誤訊息]</ref>: | |||
# 改用沒有 32767 字元數限制的檔案格式 | |||
# 使用 SUBSTRING 函數縮減內容長度 | |||
發生錯誤的 MySQL 查詢 | |||
<pre> | |||
SELECT | |||
title, | |||
content | |||
FROM my_column | |||
</pre> | |||
修正後的 MySQL 查詢 | |||
<pre> | |||
SELECT | |||
title, | |||
SUBSTRING(content, 1, 32767) AS content | |||
FROM my_column | |||
</pre> | |||
== References == | == References == | ||