Ste*_*ers 6 sql format comments formatter
我正在寻找一个可以执行此操作的SQL格式化程序:
INSERT INTO MyTable (col1, col2, col3, col4)
VALUES (
1, -- col1
2, -- col2
3, -- col3
4 -- col4
)
Run Code Online (Sandbox Code Playgroud)
我似乎无法在任何免费的在线SQL格式化程序中找到此功能,尽管可能是我看起来不够努力 - 因此问题.当然这样的事情存在 - 或者如果不是看起来很简单,我很想尝试自己写一个......
对于任何不相信这样做的人来说,这是(许多)实际插入中的一个 - 如果没有内联注释(并且每行有一个值也很有用),很难说出值代表什么:
INSERT INTO ForecastAcqControl
( ForecastImageServiceId, LayerId, Style, IsForecast, IsTiled,
LatSW, LongSW, LatNE, LongNE, PixelsWidth, PixelsHeight, ZoomLevels,
TimeCoverageHours, TimeStepMinutes, UpdateIntervalMinutes, CreatedDT
)
VALUES
(
1, -- ForecastImageServiceId: OBSERVATIONS
1, -- LayerId: RADAR_UK_Composite_Highres
NULL, -- Style
FALSE, -- IsForecast
FALSE, -- IsTiled
47, -- LatSW
-15, -- LongSW
61, -- LatNE
5, -- LongNE
1000, -- PixelsWidth
1200, -- PixelsHeight
4, -- ZoomLevels
-2, -- TimeCoverageHours
5, -- TimeStepMinutes
5, -- UpdateIntervalMinutes
UTC_TIMESTAMP() -- CreatedDT
);
Run Code Online (Sandbox Code Playgroud)
最终我自己创建了一个实用程序来执行此操作。(回想起来,正则表达式可能不是最好的方法 - 但最终还是做到了!)
该工具在这里:SQL Insert Commenter
已经做了相当多的测试,但肯定会有一些东西不起作用,所以如果有人尝试它可以让我知道任何问题,我将不胜感激......