📑 SQL 转 CSV(INSERT 语句转 CSV)SQL to CSV Converter
把 SQL INSERT 语句转换为 CSV:识别列名、多行 VALUES、多条语句,支持反引号/引号标识符、字符串转义、NULL、TRUE/FALSE,可选分隔符和是否输出表头。数据在本地处理。Convert SQL INSERT statements to CSV — reads column names, multi-row VALUES and multiple statements, with backtick/quoted identifiers, string escapes, NULL and TRUE/FALSE, a choice of delimiter and an optional header row. Processed locally.
使用说明与常见问题How-to & FAQ
「SQL 转 CSV(INSERT 语句转 CSV)」是什么?What is the SQL to CSV Converter tool?
把 SQL INSERT 语句转换为 CSV:识别列名、多行 VALUES、多条语句,支持反引号/引号标识符、字符串转义、NULL、TRUE/FALSE,可选分隔符和是否输出表头。数据在本地处理。Convert SQL INSERT statements to CSV — reads column names, multi-row VALUES and multiple statements, with backtick/quoted identifiers, string escapes, NULL and TRUE/FALSE, a choice of delimiter and an optional header row. Processed locally.
如何使用「SQL 转 CSV(INSERT 语句转 CSV)」?How do I use the SQL to CSV Converter tool?
在「SQL 转 CSV(INSERT 语句转 CSV)」中,把内容粘贴或输入到上方输入框,按需设置「分隔符」,结果会实时显示在下方,点击「复制结果」即可复制。例如输入「INSERT INTO t (a,b) VALUES (1,2,3);」,得到「a,b ⏎ 1,2,3」。In the SQL to CSV Converter: Paste or type into the input box, adjust "Delimiter"; the result appears below instantly — click "Copy result" to copy it. Example: "INSERT INTO t (a,b) VALUES (1,2,3);" → "a,b ⏎ 1,2,3".
支持哪些 SQL 写法?Which SQL is supported?
支持 INSERT INTO 表 (列…) VALUES (…), (…);INSERT IGNORE;省略列名;带库名的 db.table;MySQL 反引号、双引号和方括号标识符;-- 和 /* */ 注释。只有列名会作为表头,省略列名时不输出表头。INSERT INTO table (cols…) VALUES (…), (…), INSERT IGNORE, omitted column lists, db.table names, MySQL backtick / double-quote / square-bracket identifiers and -- and /* */ comments. Only column names form the header; with no column list, no header is written.
CSV 里的逗号和引号怎么处理?How are commas and quotes handled in the CSV?
按 RFC 4180 规则:含有分隔符、双引号或换行的字段会用双引号包裹,字段内的双引号写成两个。NULL 变成空字段,TRUE/FALSE 变成 true/false。Following RFC 4180: any field containing the delimiter, a double quote or a newline is wrapped in double quotes, and inner double quotes are doubled. NULL becomes an empty field and TRUE/FALSE become true/false.
多条 INSERT 或多张表怎么办?What about several INSERTs or tables?
所有行会合并到一个 CSV 中,表头取第一条带列名的语句。如果不同语句列数或列名不一致,请分开转换,以免列对不齐。All rows are merged into one CSV, with the header taken from the first statement that lists columns. If statements have different columns, convert them separately so the columns line up.
单引号怎么转义?How are quotes escaped?
标准 SQL 用两个单引号 '' 表示一个单引号,始终支持;MySQL 的反斜杠转义(\' \n)默认开启——若你的数据来自 PostgreSQL 等把反斜杠当普通字符的系统,请关闭它。Standard SQL doubles a single quote ('') and is always supported; MySQL-style backslash escapes (\' \n) are on by default — turn them off if your data comes from PostgreSQL or another system where a backslash is a literal character.
代码或数据会被上传吗?Is my code or data uploaded?
不会。「SQL 转 CSV(INSERT 语句转 CSV)」完全用 JavaScript 在本地运行,适合处理含有密钥、内部接口等敏感内容的数据。No. The SQL to CSV Converter runs entirely in local JavaScript, so it is safe for data containing keys or internal endpoints.
「SQL 转 CSV(INSERT 语句转 CSV)」免费吗?需要注册吗?Is the SQL to CSV Converter free? Do I need an account?
「SQL 转 CSV(INSERT 语句转 CSV)」完全免费,无需注册或安装,打开网页即可使用,手机和电脑都能用;输入的内容只在你的浏览器本地处理。The SQL to CSV Converter is completely free with no sign-up or install and works on phones and desktops; what you enter is processed only in your browser.