sql - 如何格式化 SQL 插入以对齐逗号分隔符?
问题描述
我有一个将初始数据插入/合并到表中的部署后脚本。我想格式化插入脚本,以便插入的每一行都具有相同的长度。我希望能够按住 alt 单击并为每条记录选择相同的列。
insert 语句中的值的格式为:
(123, 'File_X', 'ShortString'),
(124, 'File_XYZ', 'LoooonnnngString'),
我想要实现的是这种格式:
(123, 'File_X' , 'ShortString' ),
(124, 'File_XYZ', 'LoooonnnngString'),
我找不到任何可以配置为实现此目的的格式化程序。
解决方案
I wrote it as a comment, but as suggested by @zimek-atomek I'll make it as an answer to be clearer.
To align all the columns in the file, you can use the plugin in for Visual Studio Code called Rainbow CSV (https://marketplace.visualstudio.com/items?itemName=mechatroner.rainbow-csv)
Since the file you are going to align contains commas (but it also support other delimiters), you can use the align columns
feature mentioned in the list at the beginning of the page.
推荐阅读
- c++ - 如何从 txt 文件中读取特定行 - Qt?
- javascript - 范围滑块显示多个输出
- java - 如何制作数字格式?
- python - 使用 PySimpleGUI 将窗口划分为列会报错
- java - 如果它的 STOP 或 stop 或 StOppp,则仅在句子上匹配秒词
- node.js - 处理多个 POST 请求
- angular - Angular FormGroup 不包含模型属性
- android - Android MVVM:当相同数据是来自不同服务器端点的响应的一部分时,如何从另一个存储库更新存储库中的数据?
- angular - 如何在Angular 8中使用条件templateUrl动态创建组件?
- excel - 对象“_Worksheet”的错误 1004 方法“保护”失败